Converts GPS data to GeoJSON — the format Leaflet, Mapbox, QGIS and essentially all modern web mapping speak natively. Of the three common exchange formats, this is the one that keeps the most of what a GPX contains.
Why this loses less than KML does
properties object, so anything the GPX carried has somewhere to go: names, descriptions, timestamps, and elevation as a third coordinate. KML has no equivalent for per-point time outside an extension most viewers ignore.
Waypoints become Points, routes and tracks become LineStrings, and a multi-segment track becomes a MultiLineString so the gaps where the GPS lost signal stay gaps.
Coordinate order and the specification
[longitude, latitude, elevation]. Longitude first — the reverse of how people say coordinates aloud and the reverse of GPX's attributes. RFC 7946 is unambiguous about it, and it is the source of a great many bugs.
The same document also requires WGS84 and drops the old crs member entirely: GeoJSON coordinates are always longitude/latitude in degrees. If a file arrives declaring a projected system, you are warned — the numbers cannot be fixed without the projection parameters.
File size, and the precision option
Rounding to six decimal places is about 10 cm and loses nothing real; five is about a metre and is plenty for a map. The option is there for when the file is going over a network.
Other names for this
Also searched as “gpx to json”, “gps track to geojson”.
Questions
- Which comes first, latitude or longitude?
- Longitude. GeoJSON is [lon, lat, ele] by specification, which is the opposite of how coordinates are usually spoken.
- Are timestamps kept?
- Yes — as feature properties. This is the main advantage over converting to KML.
- How do I display the result?
- Leaflet:
L.geoJSON(data).addTo(map). Mapbox GL: add it as a geojson source. QGIS opens the file directly. - Is my file uploaded?
- No. Everything runs in this tab. That matters more here than almost anywhere else on the site — a calendar is your movements, an address book is other people’s personal data, and a GPS track is where you live and where you run. None of it is sent anywhere.