Thread: GPSEngine
View Single Post
Old January 9th, 2009, 06:36 AM   #6 (permalink)
Zorro
10 Farad - Flux Capacity
Zorro's CarPC Specs
 
Zorro's Avatar
 
Join Date: Nov 2004
Location: Munich, Germany
Vehicle: Audi A3
Posts: 1,024
Zorro is a glorious beacon of lightZorro is a glorious beacon of lightZorro is a glorious beacon of lightZorro is a glorious beacon of lightZorro is a glorious beacon of light
Send a message via Skype™ to Zorro
Quote:
Originally Posted by _Dejan_ View Post
zorro thaks for help.
I have NMEA specification... But I need help how to parse/calculate driving direction from it. Like we receive it if we call CF_GPSInfo("DIRECTION")...
So, you mean the formated string "N", "W", "E", "S" ... and so on?

First create a string like this:
Code:
 
private readonly string[] directions = new[] { "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW", "N", "NNE", "NE", "ENE" };
Then take the degree from VTG and convert it like this:
Code:
 
int dir = (int)(degree/22.5f);
if (dir >= 0 && dir < 16)
   return directions[dir];
__________________
Skinning to go... VD2
My Plugins: BluetoothControl, Contacts, Scribble, MWConn, Phidgets, Skype, PluginBrowser, LogoDashboard, SkinBrowser
My Tools: CFInjector
My Skins: Street WS, Gizmo, Cyclone, Drive
Zorro is offline   Reply With Quote
The Following User Says Thank You to Zorro For This Useful Post: