Serial port and GPS

Utils.fromGGA Method 

Parses coordinates from an NMEA GGA string

[Visual Basic]
Public Shared Function fromGGA( _
   ByRef utcTime As Double, _
   ByRef n_lat As Double, _
   ByRef e_long As Double, _
   ByRef utmnorthing As Double, _
   ByRef utmeasting As Double, _
   ByRef altitude As Double, _
   ByVal gga As String, _
   ByVal system As Datum _
) As Boolean
[C#]
public static bool fromGGA(
   out double utcTime,
   out double n_lat,
   out double e_long,
   out double utmnorthing,
   out double utmeasting,
   out double altitude,
   string gga,
   Datum system
);

Parameters

utcTime
Universal Time Coordinated, 0 for invalid GGA strings
n_lat
latitude north, negative for south, 0 for invalid GGA strings
e_long
longitude east, negative for west, 0 for invalid GGA strings
utmnorthing
utm northing coordinate resulting from toUTM, 0 for invalid GGA strings
utmeasting
utm easting coordinate resulting from toUTM, 0 for invalid GGA strings
altitude
the altitude (elevation) in meters
gga
the NMEA GGA string to parse
system
the system to use for translating into UTM coordinates, eg. WGS84

Return Value

true for success, false for invalid GGA strings.

Remarks

Parses NMEA GGA strings according to http://gpsd.berlios.de/NMEA.txt

 GGA - Global Positioning System Fix Data
 Time, Position and fix related data for a GPS receiver.
 
  0      1         2       3 4        5 6 7  8   9  10 |  12 13  14   15
  |      |         |       | |        | | |  |   |   | |   | |   |    |
  $--GGA,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx*hh
 
  Field Number:
   1) Universal Time Coordinated (UTC)
   2) Latitude
   3) N or S (North or South)
   4) Longitude
   5) E or W (East or West)
   6) GPS Quality Indicator,
      0 - fix not available,
      1 - GPS fix,
      2 - Differential GPS fix
      (values above 2 are 2.3 features)
      3 - PPS fix
      4 - Real Time Kinematic
      5 - Float RTK
      6 - estimated (dead reckoning)
      7 - Manual input mode
      8 - Simulation mode
   7) Number of satellites in view, 00 - 12
   8) Horizontal Dilution of precision (meters)
   9) Antenna Altitude above/below mean-sea-level (geoid) (in meters)
  10) Units of antenna altitude, meters
  11) Geoidal separation, the difference between the WGS-84 earth
      ellipsoid and mean-sea-level (geoid), "-" means mean-sea-level
      below ellipsoid
  12) Units of geoidal separation, meters
  13) Age of differential GPS data, time in seconds since last SC104
      type 1 or 9 update, null field when DGPS is not used
  14) Differential reference station ID, 0000-1023
  15) Checksum

 Example:
 $GPGGA,200329.000,4932.7248,N,01159.2531,E,1,06,1.5,401.0,M,47.4,M,,0000*5A
 
This method neighter uses nor validates the entire GGA string. For this method it is enough, that the fields 1, 2, 4 and 9 are valid floting point numbers with a dot as decimal separator, the fields 3 and 5 contain respectively N/S and E/W and that the field 0 has the format $..GGA meaning: char[0] is '$', char[3] and char[4] are both 'G' and char[5] is 'A'.

See Also

Utils Class | serial Namespace