GPX to GeoJSON
Paste GPX or drop a .gpx file, get GeoJSON. Waypoints become Point features, tracks become LineString or MultiLineString features. The result is saved to your session — open the viewer next to see it on a map.
GPX to GeoJSON
Before you start
You need one of the following:
- A
.gpxfile from your GPS device, Strava, Garmin Connect, or AllTrails, or - Raw GPX/XML text you can paste into the input area.
GPX is just a specific flavor of XML. This tool expects a standard <gpx> root element. If you have a .kml or .kmz file from Google Earth instead, use the KML-specific converter linked below, as the internal structures are completely different.
Like my other tools, there is no file size limit beyond what your browser can handle. I've successfully converted 50 MB tracks with hundreds of thousands of points, though your browser might chug for a second while it generates the text output.
How to use it
- Paste your GPX text into the left pane, or drop a
.gpxfile directly onto the page. - Click Convert to run the transformation logic.
- Check the right pane for the resulting GeoJSON — I've mapped waypoints to
Pointand tracks/routes toLineString. - Click Copy to grab the JSON, or Download .geojson to save it for your project.
- If you want to see the result on a map, click the Viewer link in the header.
Example
Input (simplified GPX):
<wpt lat="45.52" lon="-122.67">
<name>Portland</name>
</wpt>
Output (GeoJSON):
{
"type": "Feature",
"geometry": { "type": "Point", "coordinates": [-122.67, 45.52] },
"properties": { "name": "Portland" }
}
Notice the coordinate flip: GPX uses lat, lon in its tags, but GeoJSON requires [longitude, latitude]. I handle this swap automatically.
Tips & common pitfalls
- Coordinate order matters. If your points look like they're in Antarctica when they should be in Europe, use the GeoJSON Viewer to check if the source is malformed. Standard GPX is always Lat/Lon, and I always convert it to Lon/Lat for GeoJSON.
- Elevation and Time are preserved in the
propertiesobject (for waypoints) or as a third coordinate value[lon, lat, ele](for tracks) if your file includes them. - Massive tracks (10,000+ points) can make web maps laggy. If the output is huge, run it through the Simplify GeoJSON tool afterward to prune unnecessary vertices.
- Garmin Extensions like heart rate or cadence are often buried in
<extensions>tags. The converter tries to flatten these into properties, but very obscure vendor tags might be skipped.
Troubleshooting
I get a "Missing or invalid XML" error.
GPX is XML, which is very picky. If you missed a closing tag or didn't copy the <?xml...?> header, the parser might fail. Try dropping the actual file instead of copy-pasting to avoid encoding or truncation issues.
The output "coordinates" array is empty.
This usually happens if the GPX file contains <trk> tags but no <trkpt> children, or if the namespace in the XML header is non-standard. Ensure your file actually has recorded location data.
Related tools
See also: if you need to do something adjacent on this site, try GeoJSON to GPX to push tracks back to a Garmin or Strava, Simplify GeoJSON to thin a dense track, or KML to GeoJSON to turn KML into GeoJSON.
Frequently asked questions
Is my GPS data uploaded to your server?
No. I use a library called togeojson that runs entirely in your browser. Your coordinates, timestamps, and private heart rate data never leave your computer. Check the privacy policy if you're curious.
How are track segments handled?
A <trk> with a single segment becomes a LineString. If your track has multiple segments (breaks in recording), I convert it to a MultiLineString to preserve those gaps correctly.
Why does the GeoJSON look "minified"?
By default, I output compact JSON to save space. If you need it to be human-readable for debugging, you can run the result through the GeoJSON Formatter tool to add indentation.
Does this support Garmin's Fitness (FIT) files?
Not directly. FIT is a binary format. You'll need to export your activity as a GPX from Garmin Connect or use a tool like GPSBabel to convert FIT → GPX before pasting it here.