<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: nmea code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 21 Aug 2008 00:40:11 GMT</pubDate>
    <description>DZone Snippets: nmea code</description>
    <item>
      <title>Python: NMEA GPGGA parser</title>
      <link>http://snippets.dzone.com/posts/show/4782</link>
      <description>Not tested extensivly, use with caution! I used an LD-1W and it seems to work alright with this parser.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;class GPGGAParser(object):&lt;br /&gt;	import logging&lt;br /&gt;	&lt;br /&gt;	def __init__(self, sentance):&lt;br /&gt;		import time, logging&lt;br /&gt;		&lt;br /&gt;		logging.debug("GPPGAParser started")&lt;br /&gt;		logging.debug("Trying to parse: "+sentance)&lt;br /&gt;		(self.format,&lt;br /&gt;		 self.utc,&lt;br /&gt;		 self.latitude, &lt;br /&gt;		 self.northsouth, &lt;br /&gt;		 self.longitude, &lt;br /&gt;		 self.eastwest, &lt;br /&gt;		 self.quality, &lt;br /&gt;		 self.number_of_satellites_in_use, &lt;br /&gt;		 self.horizontal_dilution, &lt;br /&gt;		 self.altitude, &lt;br /&gt;		 self.above_sea_unit, &lt;br /&gt;		 self.geoidal_separation, &lt;br /&gt;		 self.geoidal_separation_unit, &lt;br /&gt;		 self.data_age, &lt;br /&gt;		 self.diff_ref_stationID) = sentance.split(",")&lt;br /&gt;&lt;br /&gt;		latitude_in=float(self.latitude)&lt;br /&gt;		longitude_in=float(self.longitude)&lt;br /&gt;		if self.northsouth == 'S':&lt;br /&gt;			latitude_in = -latitude_in&lt;br /&gt;		if self.eastwest == 'W':&lt;br /&gt;			longitude_in = -longitude_in&lt;br /&gt;&lt;br /&gt;		latitude_degrees = int(latitude_in/100)&lt;br /&gt;		latitude_minutes = latitude_in - latitude_degrees*100&lt;br /&gt;		&lt;br /&gt;		longitude_degrees = int(longitude_in/100)&lt;br /&gt;		longitude_minutes = longitude_in - longitude_degrees*100&lt;br /&gt;		&lt;br /&gt;		self.latitude = latitude_degrees + (latitude_minutes/60)&lt;br /&gt;		self.longitude = longitude_degrees + (longitude_minutes/60)&lt;br /&gt;		&lt;br /&gt;		self.timeOfFix = time.strftime("%H:%M:%S", time.strptime(self.utc.split(".")[0],"%H%M%S"))&lt;br /&gt;		self.altitude = float(self.altitude)&lt;br /&gt;		logging.debug("GPPGAParser finished")&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 16 Nov 2007 14:12:36 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4782</guid>
      <author>ejot (Magnus Persson)</author>
    </item>
  </channel>
</rss>
