Getting information out of GPX-Track

Hi everyone,

i recently managed to display a GPX track on my OSM Map. Waypoints and the recorded Track are displayed on top of OSM material. Everything works really great.

I was wondering now if it is possible to get additional information out of the GPX Track.
The things i want to extract and calculate are:

  • Complete distance of the track
  • Date of recording
  • Attributes of trackpoints (such as elevation information)

Is it possible to get this data in an easy way?

I’m currently parsing the GPX track via PHP which seems to work but is really really slow if its a long track. Through PHP i’m able to calculate the distance, extract the elevation data and so on.

Maybe someone has an idea or even an example where i can get a hint.

Thank you very much!

Bye,

Timo

So tell us first HOW you managed to display your GPX track! What program or web service did you use?

For examining GPX tracks you should have a look at all applications that are listed at http://wiki.openstreetmap.org/wiki/Editing_GPX_Tracks

Dis you find something good for your purposes?

I display the GPX track using standard OpenLayers functions on map material of the OSM project. For example, check out this this post on my friends blog:

http://www.walking-away.de/wanderung-maligne-canyon-jasper-np-alberta-kanada/

There you can see a map which display the GPX track.
Additionaly i wrote some PHP code to extract more information from the track to display the elevation profile below the map using the Google Chart API.
What my problem here is that it takes too much time for PHP to get all the information out of the linked GPX track. I already improved my parser but it didnt work out.

Since OpenLayers already loads the track one time, it would be great to use the already loaded track directly within JavaScript to get the information i need (like distance, elevation and so on…). When OpenLayers loads the GPX track, the information has to be there anyways. The only question is: Are there ways of getting all the information i need out of the loaded GPX file.

I hope this helps.