How to convert GPX to GeoJSON
- Drop your GPX recording from Strava, Komoot or a Garmin into the box.
- Check the preview as waypoints, tracks and routes appear while the file is parsed.
- Choose GeoJSON, convert, and download a file your map library reads directly.
What changes when you convert GPX to GeoJSON
| What | GPX → GeoJSON | |
|---|---|---|
| Geometry | Kept | Waypoints become point features and tracks and routes become lines. GPX has no polygon type, so there are no polygons to carry. |
| Attributes | Changes | GPX stores a fixed set of fields per feature (name, comment, description, symbol, type, elevation, time and a few GPS quality values), and those become attribute fields in GeoJSON. Heart rate, cadence and other app extensions are not carried. |
| Styling & labels | Kept | Neither GPX nor GeoJSON stores visual styling, so there is nothing to lose. Geometry and data carry straight over. |
| Coordinate system | Kept | Both formats are fixed to WGS84 longitude/latitude (EPSG:4326), so the coordinates are copied across without any reprojection. |
| Elevation (Z) | Kept | 3D Z values carry from GPX into GeoJSON wherever the source records them. |
| File structure | Kept | A single, self-contained .geojson file you can move around on its own. |
Why convert GPX to GeoJSON?
GPX is the language of GPS devices and fitness apps: a watch or handheld records a hike as waypoints, routes and tracks, then exports XML that does not drop cleanly into a web map. GeoJSON is the format the modern web-mapping stack speaks, so the same track renders directly in Leaflet, Mapbox GL or OpenLayers, and a Strava or Komoot ride becomes a line on your own site. The format is plain text as well, so a route can travel through web APIs the way any JSON does.
Coordinate system handling
GPX and GeoJSON make one of the few pairings with no coordinate decision anywhere, because each format is welded to WGS84 by its specification, the one by the schema GPS receivers write and the other by RFC 7946. Longitude and latitude pass through untouched, and the output carries no crs member at all, a field the RFC retired so that every consumer could assume WGS84 safely.
Web Mercator rendering needs no preparation on your side either. Leaflet, Mapbox GL and OpenLayers project degree coordinates to screen space at draw time, which means the file should stay in plain degrees, and pre-projecting it would break the assumptions those libraries build on.
What to check when converting GPX to GeoJSON
Know what geometry to expect before wiring up your map. A waypoint becomes a Point feature, a route or track becomes a LineString, and a track recorded in several segments becomes a MultiLineString, so a single ride usually lands as one line you can style. Elevation rides along as the third value in each coordinate, and names and the other fixed GPX fields become properties. App extensions, heart rate and cadence among them, are dropped; hold on to the source file when that data matters.
Troubleshooting GPX to GeoJSON
- The browser tab stalls when the layer loads. A ride logged second by second for a few hours carries tens of thousands of vertices, and a web map redraws every one of them on each pan and zoom. Thin the recording before converting, by simplifying the track in the sports app or resampling the log to one point every few seconds, and the map turns responsive.
- A time slider or animation finds no per-point timestamps. A LineString feature carries a single properties object, so the second-by-second clock readings inside a track have no vertex-level home in the output. Keep the GPX as the source for time-based work; waypoint features do keep a time property wherever the device wrote one.
- Waypoint markers pick up the styling meant for the route line. Points and lines arrive side by side in one FeatureCollection, because waypoints, routes and tracks are read together. Branch on feature.geometry.type in the style callback or pointToLayer so markers and lines each get their own treatment.
- The page shows an empty map although the JSON parses cleanly. The viewport never moved to the data, since converting changes the format rather than the position. Call fitBounds on the layer bounds in Leaflet, or fit the camera to the feature extent in Mapbox GL, and the track fills the screen.
About the formats
A GPX file is what your watch or handheld records after a hike or ride: waypoints, an ordered route, and dense tracks of timestamped points. GeoJSON is what a web map wants to draw, so this conversion turns that recorded outdoor data into features a Leaflet or Mapbox GL layer can render directly. The usual path is exporting a track from Strava or Komoot and reshaping it here so JavaScript can read every point and property.
Frequently asked questions
Did my track come out as a line or as loose dots?
A track or route becomes a continuous LineString, while waypoints become individual Point features. Check which of the three landed in your output before you load it.
Why does longitude come first in each coordinate pair?
GeoJSON stores longitude before latitude, and that order comes straight from the specification rather than from a conversion error.
Can I keep the route under version control in Git?
Yes. GeoJSON is plain text, so every edit to the route shows line by line in a diff.
Can I load the GeoJSON straight into Leaflet or Mapbox?
Yes. GeoJSON is the native vector format for Leaflet, Mapbox GL and OpenLayers, so you can pass the output directly to an L.geoJSON layer or a map source with no extra conversion.
Related converters
Ready to convert?
Drop a file and download the result in seconds. Nothing is uploaded, nothing is stored.