Question

I know GPX is a light-weight XML data format but what I want to know is it possible to add my own tag like <Town> Some Town here </Town> which will hold the nearest town that the GPS data was done near or would I have to save this in a seperate XML file?

Was it helpful?

Solution

All the gpx types, including <gpx/> itself, have have something called <extensions/>. Extensions can hold any xml content you want. The only requirement is that what you put in there is linked to a different schema. Therefor it's required to use a namespace for your tags.

You can put something like <myns:town>Some town here</myns:town> in there assuming you define the myns namespace in the top.

  • You can read more about this in the Gpx specs here
  • Garmin uses extensions extensively. To get an idea how they do it you can get their schema here
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top