Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
    
After a week or two and a bounty I think the answer to my question here is "no, there is no library for GPX track processing". Lots of applications and code, but no general purpose tool. It's helpful to know that. For me the way forward is to write some PostGIS code that works with the schema created by ogr2ogr's GPX import. That schema contains both a simple LineString for the track and a table of points with timestamps for the time dimension. –  Nelson Apr 24 '12 at 16:12
    
Is Delphi code an option too? –  menjaraz Apr 28 '12 at 5:39
    
Google just announced a Tracks API I'm mentioning here for completeness. It looks useful but in a different direction than I'm looking for; more about breadcrumbs and geofences. –  Nelson Oct 17 '12 at 15:02
1  
@Nelson Take a look at this answer, from one of the creator of (rather excellent online ride editor) Ride With GPS: stackoverflow.com/a/13084082/401828 –  heltonbiker Oct 26 '12 at 12:36

7 Answers 7

Well, kinda depends on your programming-language of choice, but i've developed mineturer.org in Java (the site is essentially a site for uploading, analyzing and displaying GPX-data).

Iv'e used JAX-B (http://jaxb.java.net/) to read GPX files (based on the GPX schema) and JTS (http://www.vividsolutions.com/jts/) + own code for analyzing.

The source code for mineturer.org is available under a MIT-licence at https://bitbucket.org/atlefren/gpsorganizer/

I guess the code could give you some pointers at least?

share|improve this answer
    
Thanks! Your site looks great (and is pretty usable via Google Translate even if you don't read Norwegian). You're doing exactly the kind of analysis I want and it's a big help you've open sourced it. For Python I'd probably use GEOS instead of JTS; there's decent bindings. –  Nelson Apr 16 '12 at 18:49
2  
if you like it ... upvote it!! –  Stev_k Apr 17 '12 at 14:50

The GPS Toolkit should help. It's an open source library and suite of applications that aims to free researchers from lower level coding.

It provides the following functionality:

  • RINEX utilities
  • Positioning
  • Residual analysis
  • Ionospheric modeling
  • Signal Tracking Simulation T
  • Basic transformations
  • Observation data collection and conversion
  • File comparison and validation.
  • Data editing
  • Autonomous and relative positioning.
share|improve this answer
    
Thanks for the answer! GPSTk looks fascinating but it's at a lower level than I'm looking for. It seems to be about working with raw GPS radio signals and deriving location fixes from them. I already have location fixes from my consumer GPS hardware and no access to the low level satellite data. –  Nelson Apr 15 '12 at 18:52

Excellent question! I've been working quite a bit with GPX data lately and the simplest solution that I have found has been to convert your track points into a spatial db format and then create views (spatial and tabular) to summarize the data as needed. I was unable to get the results needed using OGR to import my GPX data, so I ended using a simple python script to traverse the XML tree structure of the GPX and load it into the db (SpatiaLite in my case). This definitely doesn't help you in avoiding reinventing the wheel, however I found that I was able to get the desired results of summarizing tracks by trip using existing SQL and spatial SQL functions.

share|improve this answer
1  
The main drawback I've seen with using PostGIS LineStrings is they don't contain timestamp data. I can certainly track them myself in a separate schema, but then PostGIS isn't doing anything to help me do time-based calculations. Do you have any tricks for that? –  Nelson Apr 16 '12 at 18:43

I am developing this small soft for my own use. It is mainly for visualisation and does not support all your needs, but maybe it may help!

share|improve this answer
    
Thanks! It's open source and in Java, so that's definitely a help. –  Nelson Apr 21 '12 at 0:47

at the risk of not answering your actual question :-), let me suggest a great application you might not have heard of, that does all that you listed -

it's my one-stop-shop for viewing, editing, and transferring GPX, among other things.

And perhaps more on-topic, maybe checkout the Positioning namespace of dotSpatial (.NET): http://dotspatial.codeplex.com/wikipage?title=DotSpatial.Positioning

Regards.

share|improve this answer
    
Thanks! TopoFusion is a great application for Windows, but I really need a library. dotSpatial has some useful-looking code to crib. It's under Mozilla Public License. –  Nelson Apr 21 '12 at 0:53

If you'd like some abstract specification for a language-neutral, API, there is GeoAPI:

"The development community in building GIS solutions is sustaining an enormous level of effort. The GeoAPI project aims to reduce duplication and increase interoperability by providing neutral, interface-only APIs derived from OGC/ISO Standards."

http://www.geoapi.org/

and more specifically the Implementation Standard (PDF)

share|improve this answer

Upload your GPX track to this URL

You will be provided with most of the services you requested, specifically:

  • Calculate the distance travelled on the track
  • Calculate the average speed
  • Calculate time in motion vs. time stationary (visible on the speed profile)
  • Simplify the track, eliminate stationary segments
  • Smooth out GPS sampling error
  • Converts the track KML/KMZ etc for visualization
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.