GPX

From OpenStreetMap Wiki
(Redirected from GPX Import Failures)
Jump to navigation Jump to search

GPX, or GPS exchange format, is an XML file format for storing coordinate data. It can store waypoints, tracks, and routes in a way that is easy to process and convert to other forms.

It is possible and welcome to upload GPS tracks, GPX files can be also opened in JOSM and be used during editing.

All GPS data used by OpenStreetMap is converted to GPX format before it can be uploaded.

Example

The following file extract shows an example of how a single waypoint (called "LAGORETICO") and a series of track points are represented in the GPX file.

<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.0">
	<name>Example gpx</name>
	<wpt lat="46.57638889" lon="8.89263889">
		<ele>2372</ele>
		<name>LAGORETICO</name>
	</wpt>
	<trk><name>Example gpx</name><number>1</number><trkseg>
		<trkpt lat="46.57608333" lon="8.89241667"><ele>2376</ele><time>2007-10-14T10:09:57Z</time></trkpt>
		<trkpt lat="46.57619444" lon="8.89252778"><ele>2375</ele><time>2007-10-14T10:10:52Z</time></trkpt>
		<trkpt lat="46.57641667" lon="8.89266667"><ele>2372</ele><time>2007-10-14T10:12:39Z</time></trkpt>
		<trkpt lat="46.57650000" lon="8.89280556"><ele>2373</ele><time>2007-10-14T10:13:12Z</time></trkpt>
		<trkpt lat="46.57638889" lon="8.89302778"><ele>2374</ele><time>2007-10-14T10:13:20Z</time></trkpt>
		<trkpt lat="46.57652778" lon="8.89322222"><ele>2375</ele><time>2007-10-14T10:13:48Z</time></trkpt>
		<trkpt lat="46.57661111" lon="8.89344444"><ele>2376</ele><time>2007-10-14T10:14:08Z</time></trkpt>
	</trkseg></trk>
</gpx>

How can I show my GPX track on an OpenStreetMap?

See track drawing websites. Also you may use other software; there are many which offer GPX displaying. For showing a GPX track for the purpose of editing OSM, see Editors.

Troubleshooting

Why didn't my GPX file upload properly?

Is your file only waypoints?

The importer doesn't import waypoints, so if your file consists only of waypoints it will fail. (This is because these often contain copyrighted data: the most famous example is that Garmin GPS units often include the locations of the Garmin offices around the world.)

Does your file contain problem data?

All data formats must be valid. Two common problems:

  • Some GPS setups throw in "NaN" (not a number) as an elevation value. Deleting those lines from the file fixes the upload.
  • Ampersands ('&' symbols) in <name> tags are not accepted.
For example, this name will not be accepted (giving a "Generic XML parse error"):
<wpt lat="-20.089861" lon="57.511535">
    <name>The Grand Mauritian resort & spa</name>
This will be accepted:
<wpt lat="-20.089861" lon="57.511535">
	<name>The Grand Mauritian resort and spa</name>

Does your file use valid timestamps?

The file must have timestamps, because they're used to work out speed, and so on.

Timestamps must also be in a valid format.

Known issues:

  • Many Garmin units have the option to remove timestamps on save. Make sure you upload GPX files created from the active track(s) on the device, not saved versions.
  • Some apps use Perso-Arabic digits for timestamps when exporting to GPX, which is unreadable by OpenStreetMap. Until there's a fix for that, either directly upload active track(s) from the device or convert timestamps of your exported track(s) and then upload them. This perl script can do the conversion.

If you write software that creates GPX files, use a validator with Schema validation to find potential problems: e.g., xmlvalidation.

If you include an encoding tag, the value "UTF-8" is accepted, while "utf8" (no dash) isn't.

The format for the GPX files as below is acceptable:

<?xml version="1.0"?>
<gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.topografix.com/GPX/1/0" version="1.0" creator="GPSBabel - http://www.gpsbabel.org" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
  <time>2005-11-07T14:00:09Z</time>
  <trk>
    <name>ACTIVE LOG</name>
    <trkseg>
      <trkpt lat="52.564001083" lon="-1.826841831">
        <ele>115.976196</ele>
        <time>2005-11-07T12:03:31Z</time>
      </trkpt>
    </trkseg>
  </trk>
</gpx>

GPX 1.1 will also work:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.topografix.com/GPX/1/1" version="1.1" creator="EMTAC BTGPS Trine II DataLog Dump 1.0 - http://www.ayeltd.biz" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
  <metadata>
    <name>GPS Receiver track log</name>
    <desc>Tallinn (car)</desc>
    <author>
      <name>Michael Collinson</name>
      <email id="mikes" domain="ayeltd.biz"/>
      <link href="http://www.ayeltd.biz">
        <text>AYE Ltd.</text>
      </link>
    </author>
    <time>2007-10-02T09:22:06Z</time>
    <keywords>Estonia, Tallinn, A. Weizbergi</keywords>
    <bounds minlat="59.4367664166667" maxlat="59.4440920666666" minlon="24.74394385" maxlon="24.7971432"/>
  </metadata>
  <trk>
    <src>Logged by Michael Collinson using EMTAC BTGPS Trine II</src>
    <link href="http://www.ayeltd.biz">
      <text>AYE Ltd.</text>
    </link>
    <trkseg>
      <trkpt lat="59.4408327" lon="24.74516185">
        <ele>44</ele>
        <time>2007-10-02T07:54:30Z</time>
        <fix>3d</fix>
        <hdop>300</hdop>
        <vdop>300</vdop>
        <pdop>300</pdop>
      </trkpt>
    </trkseg>
  </trk>
</gpx>
Fixing timestamp issues
  • You can add fake timestamps (anonymize time) with GPX Editor.
  • If you can't get your GPX with timestamps, you can use JOSM's EditGPX plugin
  • Open your GPX file, click on the edit GPX tracks icon, choose your GPX file in the popup and then right click on the new GPX layer and convert it to a "GPX layer with anonymised time". Save this new GPX layer as a file and upload it to OSM.
  • Alternative option for command line users, e.g., for a Bash shell on a GNU/Linux system):
$ xmlstarlet ed -N x=http://www.topografix.com/GPX/1/0 -N y=http://www.topografix.com/GPX/1/1 \
    -s '//x:trkpt|//y:trkpt' -t elem -n time -v 1970-01-01T00:00:00Z track.gpx > track-nulltime.gpx

Is the server working?

Another reason for import failure may be server-side. Please consult the platform status page to see whether a technical problem is known that prevents even correct GPX files from being imported.

Why are the points on my tracks spaced out?

This is due to the GPS device — usually a Garmin — being set to record on "Auto", which saves space by recording fewer points on straights. It's not usually a problem in rural areas, but isn't much use for city mapping. To make the GPS record more points, go to the track settings menu on your GPS, and change the recording method to "Time" or "Distance".

  • Time: Time will record points every "x" seconds/minutes/hours. This can be changed on some GPS devices. Having this setting will use up the memory fast, but will increase the points considerably. The disadvantage of this method of saving is that when moving slowly with the GPS device the points will become densely packed. For example, many Garmin GPS's have a maximum tracklog capacity of 10,000 points. (Note that some devices also allow a log to be stored on a memory card in addition to the regular tracklog.) Setting a time interval of 1 second normally gives close to 3 hours of mapping (always a few points are not written due to errors and satellite availability). For fast road driving a 1-second interval gives very good trace information. The 1-second interval also works well for cycling in urban areas. For walking the rate can be decreased without loss of track definition to 2 or 3 seconds. The interval can also be increased when the mapping time needs to be extended, but try to avoid unnecessary time intervals. You can change the time interval on the fly, useful if you decide to stay out longer than planned. If your GPS-Unit doesn't impose you serious restrictions on storage capability, experienced mappers generally use a setting of 1 point/second to get best results in all mapping conditions. Some advantages of the time setting are that relative speed can be judged by the spacing, There are more points when you slow down for curves or turns and fewer on straightaways.
  • Distance: Distance will record points every "x" meters/yards. This can be changed on some GPS devices. Having this setting will use up the memory quickly, although relative to your speed. The disadvantage of this method of saving is that when traveling on straight, high-speed motorways, unnecessary points will be recorded. Also, if you are to be tracking a small area, if the "x" value is too high, your route will be unclear. In general, distance recording can miss the subtleties of curves and direction changes, especially in urban areas.
  • Wrapping: If the option is available to turn on, or off the wrapping function, then having it off is also advised. Having wrapping on means that when full, the GPS device will make room to record the latest section of your route by overwriting the beginning of your route. It will delete the beginning, point by point, at the same rate as new points are created. The exception would be when you are logging track data to a data card in some Garmin models. The beginning data will be deleted from the device's built-in memory, but not from the data card.

Exporting from OSM to GPX

The following tools can be used to export OSM data as GPX points. This is useful, e.g., for hikers who have a GPS device or phone. It can be loaded into OsmAnd quite easily to give an overview of the features of interest.

Most routing Web sites can also export routes to GPX:

See also

External links