GPX to GeoJSON Converter

Convert GPX track files to GeoJSON format. Transform GPS data for web mapping.

Skip to the tool

GPX is the export format every GPS device, fitness tracker, and mapping app emits — Garmin, Strava, Komoot, Wikiloc, Suunto, the OS Maps app. It's great for moving tracks between devices and useless for rendering on the modern web until you convert it. Most fitness-data side projects start with this conversion.

Paste GPX XML or upload a .gpx file on the left. The converter walks every <trk>, <rte>, and <wpt>, emits a LineString per track segment and a Point per waypoint, and lifts elevation, time, and extension data into the resulting Feature's properties. The output is a single FeatureCollection ready to drop into Leaflet.

Below the converter the body covers GPX's track-vs-route distinction, what happens to cadence/heart-rate extensions (preserved as foreign-named properties), and how to slim a 12-hour Strava export with the simplifier before rendering. Time series are kept on every coordinate so you can replay a track at speed.

Watch out for: multi-segment tracks. A single GPX file from a long ride with a lunch break often contains one <trk> with multiple <trkseg> children. Naive converters concatenate all segments into one LineString — which then connects the start of segment 2 to the end of segment 1 with a straight line through your lunch spot. This converter emits a MultiLineString in that case so the gap is preserved. If your map library only handles LineString, ask explicitly for the largest segment.

What Is GPX?

GPX (GPS Exchange Format) is an XML-based format for storing GPS data — tracks, routes, and waypoints. It is the standard export format for GPS devices (Garmin, Suunto, etc.), fitness apps (Strava, Komoot), and outdoor navigation software.

How the Conversion Works

Paste your GPX XML content and the tool converts it to GeoJSON. The mapping is:

  • Waypoints (<wpt>) → GeoJSON Point features
  • Tracks (<trk>) → GeoJSON LineString features (one per track segment)
  • Routes (<rte>) → GeoJSON LineString features
GPX<wpt lat="40.7484" lon="-73.9857">
  <name>Empire State Building</name>
  <ele>443</ele>
</wpt>

Metadata like name, description, elevation, and timestamps are preserved as Feature properties where available.

Common Use Cases

  • Visualizing GPS tracks from hiking, cycling, or running activities on a web map
  • Converting Strava or Garmin exports into GeoJSON for custom analysis
  • Importing GPS waypoints into web-based mapping applications
  • Combining GPS data with other GeoJSON layers using the merge tool

After conversion, you can measure the track length, simplify the route for smaller file sizes, or view it on a map.

Try It

Paste this GPX waypoint for the Statue of Liberty. The converter produces a GeoJSON Point feature with the name and elevation preserved as properties:

GPX<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="test">
  <wpt lat="40.6892" lon="-74.0445">
    <name>Statue of Liberty</name>
    <ele>93</ele>
    <desc>Liberty Island, New York Harbor</desc>
  </wpt>
</gpx>

The resulting GeoJSON output:

GeoJSON{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "name": "Statue of Liberty",
        "ele": 93,
        "desc": "Liberty Island, New York Harbor"
      },
      "geometry": {
        "type": "Point",
        "coordinates": [-74.0445, 40.6892]
      }
    }
  ]
}

Notice that GPX stores coordinates as XML attributes (lat and lon), while GeoJSON uses a [longitude, latitude] array. The converter handles this reordering automatically.

How the GPX Parser Works

The converter parses the GPX XML document and iterates over three element types: <wpt> (waypoints), <trk> (tracks), and <rte> (routes). Waypoints become Point features. Track segments (<trkseg>) become LineString features by collecting all <trkpt> elements in order. Routes similarly become LineStrings from their <rtept> elements.

GPX files from fitness devices often contain thousands of trackpoints recorded at one-second intervals. After converting to GeoJSON, you can use the simplifier to reduce the vertex count, or consult the Web Mapping Guide for tips on displaying GPS tracks on interactive maps.