Using GPS data
The most common type of GPS data these days is the Garmin GPX format. We covered this XML format, which has become an unofficial industry standard, in Chapter 4, Geospatial Python Toolbox. Because it is an XML format, all of the well-documented rules of XML apply to it. However, there is another type of GPS data that pre-dates XML and GPX, called National Marine Electronics Association (NMEA) data. This data is ASCII text sentences that are designed to be streamed.
You occasionally bump into this format from time to time because even though it is older and esoteric, it is still very much alive and well, especially for communicating ship locations via the Automated Identification System (AIS), which tracks ships globally. But as usual, you have a good option in pure Python. The pynmea
module is available on PyPI
. The following code is a small sample of NMEA sentences:
$GPRMC,012417.859,V,1856.599,N,15145.602,W,12.0,7.27,020713,,E\*4F $GPGGA,012418.859,1856.599,N...