I keep writing custom code to work with GPS tracks: GPX files and NMEA logs from my phone, dedicated GPS logger, etc. I feel like I'm reinventing the wheel and am wondering if there's some standard library / tool I can use to work with GPS tracks. Some of the things I like to do:
- Calculate the distance travelled on the track
- Calculate the average speed and instantaneous speeds along the track
- Calculate time in motion vs. time stationary
- Simplify the track, eliminate stationary segments
- Segment a track into separate tracks, one per trip
- Smooth out GPS sampling error
- Create an elevation profile by looking up points in a DEM
- Convert the tracks to GPX, KML, etc for visualization
There are a variety of applications that analyze GPS tracks. I'm looking for a software library or scriptable set of tools so I can write my own applications. I don't much care about input formats; any sort of timestamped lat/lon points is fine. I mostly work in Python on Unix but pretty much any language will do.
Existing tools I use include GPSBabel and GDAL/OGR for conversion and PostGIS for working with the track geometry as a line string. But mostly I end up writing my own Python code that works on arrays of lat/lon pairs and that feels too low level. Also some of the tasks above (like removing GPS error) are quite subtle. Is there some existing library out there I should be using?