From OpenStreetMap Wiki
Jump to: navigation, search
Available languages — GPX
· Afrikaans · Alemannisch · aragonés · asturianu · azərbaycanca · Bahasa Indonesia · Bahasa Melayu · Bân-lâm-gú · Basa Jawa · Baso Minangkabau · bosanski · brezhoneg · català · čeština · dansk · Deutsch · eesti · English · español · Esperanto · estremeñu · euskara · français · Frysk · Gaeilge · Gàidhlig · galego · Hausa · hrvatski · Igbo · interlingua · Interlingue · isiXhosa · isiZulu · íslenska · italiano · Kiswahili · Kreyòl ayisyen · kréyòl gwadloupéyen · Kurdî · latviešu · Lëtzebuergesch · lietuvių · magyar · Malagasy · Malti · Nederlands · Nedersaksies · norsk bokmål · norsk nynorsk · occitan · Oromoo · oʻzbekcha/ўзбекча · Plattdüütsch · polski · português · română · shqip · slovenčina · slovenščina · Soomaaliga · suomi · svenska · Tiếng Việt · Türkçe · Vahcuengh · vèneto · Wolof · Yorùbá · Zazaki · српски / srpski · беларуская · български · қазақша · македонски · монгол · русский · тоҷикӣ · українська · Ελληνικά · Հայերեն · ქართული · नेपाली · मराठी · हिन्दी · অসমীয়া · বাংলা · ਪੰਜਾਬੀ · ગુજરાતી · ଓଡ଼ିଆ · தமிழ் · తెలుగు · ಕನ್ನಡ · മലയാളം · සිංහල · ไทย · မြန်မာဘာသာ · ລາວ · ភាសាខ្មែរ · ⵜⴰⵎⴰⵣⵉⵖⵜ · አማርኛ · 한국어 · 日本語 · 中文(简体)‎ · 吴语 · 粵語 · 中文(繁體)‎ · ייִדיש · עברית · اردو · العربية · پښتو · سنڌي · فارسی · ދިވެހިބަސް

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. All GPS data used by OpenStreetMap is converted to GPX format before it can be uploaded.


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">
	<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>


Why didn't my GPX file upload properly?

Your GPX should consist of trackpoints with valid timestamps. The ele(vation) tag is optional and will default to 0. Note if using a Garmin GPS device: Many of these units have the facility to save the track that strips out the timestamps. Saved tracks will fail to be imported to OSM because of this. Instead make sure you upload GPX files created from the active track(s) from the device rather than any tracks you have saved.

If you write software that creates GPX files, use a validator (e.g. xmlvalidation) with Schema validation to find potential problems. 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=&quot;1.0&quot;?>
creator=&quot;GPSBabel -;
  <name>ACTIVE LOG</name>
<trkpt lat=&quot;52.564001083&quot; lon=&quot;-1.826841831&quot;>

GPX 1.1 will also work:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<gpx version="1.1"
    creator="EMTAC BTGPS Trine II DataLog Dump 1.0 -"
<name>GPS Receiver track log</name>
<desc>Tallinn (car)</desc>
<name>Michael Collinson</name>
<email id="mikes" domain="" />
<link href=""><text>AYE Ltd.</text></link>
<keywords>Estonia, Tallinn, A. Weizbergi</keywords>
<bounds minlat="59.4367664166667" maxlat="59.4440920666666" minlon="24.74394385" maxlon="24.7971432"/>
<src>Logged by Michael Collinson using EMTAC BTGPS Trine II</src>
<link href=""><text>AYE Ltd.</text></link>
    <trkpt lat="59.4408327" lon="24.74516185">

There are two things the importer won't do. First, it won't take in GPS points without timestamps as they're to be used to work out speed and so on. The other is that it doesn't import waypoints and your file consists only of waypoints. Opening and saving with GPX Editor will solve some problems. It can attach fake timestamps (anonymize time) if your file lacks them.

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= -N y= \
    -s '//x:trkpt|//y:trkpt' -t elem -n time -v 1970-01-01T00:00:00Z track.gpx > track-nulltime.gpx

The reason for this is that if you reset many GPS units or download map data to them, then you often get copyrighted data put in the GPX. The most famous example is that if you reset a Garmin GPS unit then it will put the locations of the Garmin offices around the world as waypoints on the unit.

Tracks will fail to upload if data formats are not correct, for example my GPS setup occasionally throws in a NaN as an elevation value. Deleting those lines from the file fixes the upload.

Another cause of problems is ampersands "&" within waypoint names - e.g.

<wpt lat="-20.089861" lon="57.511535">
    <name>The Grand Mauritian resort & spa</name>

Won't work, giving a "Generic XML parse error" but:

<wpt lat="-20.089861" lon="57.511535">
	<name>The Grand Mauritian resort and spa</name>

Will work fine.

Another reason for import failure may be on the 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 either '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/s 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 less on straightaways where you need fewer points.
  • 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 fast, although relative to your speed. The disadvantage of this method of saving is that when traveling on straight roads fast, (motorways/highways), 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 deleting 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.

How can I show my GPX track on an OSMap?

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 editing.

See also