GPX to GeoJSON Converter

Turn GPS tracks into GeoJSON for web maps and data pipelines

Free GPX to GeoJSON converter that runs fully in your browser. Converts GPX waypoints, tracks and routes into RFC 7946 FeatureCollections with Point and LineString geometries for Leaflet, Mapbox and QGIS. Your routes never leave your device. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What GeoJSON geometries are produced?

Waypoints become Point features. Each track segment and each route becomes a LineString feature whose coordinates are the ordered points. Everything is wrapped in a single FeatureCollection per RFC 7946.

GPX is the format GPS devices export; GeoJSON (RFC 7946) is the lingua franca of web mapping libraries like Leaflet and Mapbox GL and desktop GIS like QGIS. This free converter turns one into the other in your browser, so you can put a recorded route on a web map or into a data pipeline without uploading your private location history.

How it works

The converter parses the GPX and emits a GeoJSON FeatureCollection:

  1. DOMParser reads the GPX and finds every wpt, trk and rte.
  2. Each waypoint becomes a Feature with Point geometry; its name/desc go into properties.
  3. Each track segment (trkseg) and route is flattened into an ordered coordinate array and emitted as a LineString feature.
  4. Coordinates are written as [lon, lat, ele]longitude first, the order RFC 7946 mandates — with elevation added as a third value when present.

The result is a single FeatureCollection, valid GeoJSON ready for any mapping tool.

Tips and example

A GPX waypoint <wpt lat="48.2082" lon="16.3738"/> becomes:

{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [16.3738, 48.2082] }, "properties": {} }

Note the reversed order: GeoJSON is [lon, lat], the opposite of how you usually say a coordinate aloud. A common mistake is feeding [lat, lon] into a map and seeing points land in the wrong hemisphere — this tool always writes longitude first.

Everything runs locally; your GPS data is never uploaded.

Using the GeoJSON output

Leaflet

In Leaflet, you can load the converted GeoJSON directly using L.geoJSON:

fetch("my-track.geojson")
  .then(r => r.json())
  .then(data => L.geoJSON(data).addTo(map));

This renders all features in the FeatureCollection automatically: waypoints appear as markers (Points) and tracks appear as polylines (LineStrings). You can pass a style function to L.geoJSON to control line color and weight.

Mapbox GL JS

In Mapbox, add the GeoJSON as a source and then create a layer for it:

map.addSource("route", { type: "geojson", data: "my-track.geojson" });
map.addLayer({ id: "route-line", type: "line", source: "route" });

Mapbox GL handles both Points and LineStrings in the same source; you use the layer’s filter property to address each geometry type separately.

QGIS and desktop GIS

QGIS can open GeoJSON files directly via Layer > Add Layer > Add Vector Layer. The file will import as a vector layer with the name and description properties from the GPX available as attributes in the attribute table.

The coordinate-order trap

GeoJSON requires [longitude, latitude] — the opposite of how coordinates are usually spoken or written. GPX stores lat and lon as named attributes, making it explicit. Many bugs in web mapping code arise from feeding GeoJSON point coordinates to a library that expects [lat, lon] (some older libraries default to this order). The standard [lon, lat] order is what RFC 7946 mandates and what this converter produces.

A symptom of a coordinate-order mix-up: your route appears in the ocean or in an unexpected location — often a mirror image of the correct location. If this happens in your mapping tool, check whether the library documentation specifies the coordinate order it expects.

Waypoints vs tracks vs routes in GPX

GPX defines three distinct data structures:

  • Waypoints (wpt) — individual named points: trailheads, summits, parking locations. Each becomes a GeoJSON Point feature.
  • Tracks (trk, trkseg, trkpt) — recorded GPS paths. A track can have multiple segments (for example, a route resumed after a device restart). Each segment becomes a separate LineString feature.
  • Routes (rte, rtept) — planned paths (turn-by-turn navigation waypoints). Each route becomes a LineString feature.

All three are converted and included in the output FeatureCollection.