A practical guide to the GPX GPS format: what waypoints, tracks and routes are, how they map to GeoJSON, the coordinate-order trap, GPX 1.0 vs 1.1, and measured output sizes when converting one real 769-byte GPX to GeoJSON, KML and CSV in the browser.
If you have ever taken a hike with a Garmin, recorded a bike ride on a phone, exported a survey path from a handheld unit, or downloaded a trail from OpenStreetMap, you have a GPX file. GPX — the GPS Exchange Format — is the closest thing the GPS world has to a universal file. It is the format Garmin, Strava, OSM, and a thousand apps all speak, and it is the first thing you reach for when you want to get a recorded path off a device and into something you can actually map, analyse, or share.
But "universal" does not mean "obvious." A GPX file can hold three completely different kinds of geometry at once, it can be written in two different schema versions, and converting it to something a web map or a spreadsheet can use is exactly where people get stuck. This article explains what is actually inside a GPX, how its three element types become GeoJSON features, where the coordinate-order trap lives, how GPX 1.0 differs from 1.1, and then measures the real outputs of converting one genuine 769-byte GPX to GeoJSON, KML, and CSV on geoo.app. Every number below is measured, not approximated.

Figure 1. One GPX, three exports, measured in the browser.
GPX is an XML schema (version 1.1, originally published by Topografix and now widely supported by OpenStreetMap tooling and virtually every GPS vendor) for storing waypoints, tracks, and routes produced by GPS devices. It is plain text, it is human-readable, and it is almost always in WGS84 longitude/latitude — which means, unlike a DWG or a Shapefile in a projected grid, you can usually plot it the moment you have it. That single property is why GPX is the default interchange format for anything that came off a GPS receiver.
A minimal GPX looks like this (this is the real sample we will measure throughout the article):
<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" xmlns="http://www.topografix.com/GPX/1/1">
<wpt lat="40.0" lon="-105.0">
<name>Waypoint A</name>
<desc>A test waypoint</desc>
<sym>flag</sym>
</wpt>
<wpt lat="40.5" lon="-104.5">
<name>Waypoint B</name>
</wpt>
<rte>
<name>Route 1</name>
<rtept lat="39.0" lon="-106.0"><name>Start</name></rtept>
<rtept lat="39.5" lon="-105.5"><name>Middle</name></rtept>
<rtept lat="40.0" lon="-105.0"><name>End</name></rtept>
</rte>
<trk>
<name>Track 1</name>
<trkseg>
<trkpt lat="41.0" lon="-107.0"></trkpt>
<trkpt lat="41.5" lon="-106.5"></trkpt>
<trkpt lat="42.0" lon="-106.0"></trkpt>
</trkseg>
</trk>
</gpx>
It helps to know why you have a GPX in the first place, because the source tells you which of the three element types you should expect inside:
.gpx full of <trkpt> breadcrumbs.<extensions> metadata.Knowing the source answers the first question a converter raises: "is this a record of where I went (track), a plan of where I intend to go (route), or a set of points (waypoints)?" Those three are not interchangeable, and conflating them is the single most common GPX mistake.
You might reasonably ask why GPS devices do not just write GeoJSON. The answer is that GPX was designed in an era when devices were tiny and needed a forgiving, self-describing text format that could carry time and elevation alongside position, and that could separate "where I went" from "where I planned to go." GeoJSON has no native concept of a track versus a route; KML does, but KML is heavier and less uniformly supported by embedded GPS firmware. GPX sits in the sweet spot: small, widely supported, and semantically rich for GPS use. You convert out of GPX when you need a map, a spreadsheet, or a web API — which is the whole subject of this article.
GPX distinguishes three geometries, and mixing them up is the most common conversion mistake:
<wpt> — waypoint. A single point: a flag, a campsite, a photo location, a geocache. Maps to a Point feature.<rte> / <rtept> — route. A planned path: an ordered list of waypoints you intend to navigate. Maps to a LineString.<trk> / <trkseg> / <trkpt> — track. A recorded path: the actual breadcrumb trail your device logged. Also maps to a LineString.In our sample there are exactly: 2 waypoints, 1 route (3 points), and 1 track (3 points).
The distinction matters because a route and a track can look identical on a map yet mean completely different things. A route is a plan — "I will go Start → Middle → End." A track is a record — "I actually went here, at these times, at these elevations." If you convert a recorded track into a planned route and send it back to a device, you have silently turned "what happened" into "what to do," which is how people end up navigating to a path they already walked.

Figure 2. The three GPX elements map to two GeoJSON geometry types.
Not every attribute in a GPX makes it into every output format. Here is what to expect when you convert the three element types to GeoJSON, KML, and CSV:
| GPX element | Geometry in GeoJSON | Name/desc preserved? | Elevation/time preserved? | In CSV? |
|---|---|---|---|---|
<wpt> | Point | Yes (name, desc, sym) | If present (ele, time) | Yes (one row) |
<rte> + <rtept> | LineString | Yes (route name; point name in properties) | If present | Yes (one row per rtept) |
<trk> + <trkseg> + <trkpt> | LineString (or MultiLineString) | Yes (track name; point name in properties) | Yes (ele, time usually kept) | Yes (one row per trkpt) |
The headline: GeoJSON and KML both preserve names and (typically) elevation and time as properties or ExtendedData; CSV keeps only coordinates by default and is the place where rich attributes are most likely to be dropped unless you specifically request extra columns.
The de facto converter is togeojson (the Mapbox/Placemark library, also used inside many desktop tools). Its rules are simple and predictable:
<wpt> → a Point feature<rte> → a LineString feature<trk> → a LineString feature (a track with multiple segments becomes a MultiLineString)So our sample — 2 waypoints, 1 route, 1 track — becomes a GeoJSON FeatureCollection with 4 features: 2 LineString + 2 Point, holding 8 coordinate pairs in total. The coordinates are already lon/lat, so the result plots immediately:
{
"type": "FeatureCollection",
"features": [
{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [-105.0, 40.0] } },
{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [-104.5, 40.5] } },
{ "type": "Feature", "geometry": { "type": "LineString", "coordinates": [[-106.0,39.0],[-105.5,39.5],[-105.0,40.0]] } },
{ "type": "Feature", "geometry": { "type": "LineString", "coordinates": [[-107.0,41.0],[-106.5,41.5],[-106.0,42.0]] } }
]
}
Notice the coordinate order carefully. GPX stores positions as lat="..." lon="..." attributes — latitude first, then longitude. GeoJSON (and everything that reads it — Leaflet, Mapbox, QGIS, Google Earth) expects longitude, latitude — longitude first, then latitude. A correct converter flips them. Ours did: the waypoint at lat="40.0" lon="-105.0" became [-105.0, 40.0].
If a converter forgets to flip, your point comes out as [40.0, -105.0] — a location in the Gulf of Guinea / eastern Atlantic rather than Colorado, USA. This is the GPX equivalent of the DWG coordinate-system trap: the geometry is fine, the interpretation is wrong, and the symptom is "all my points are in the ocean." If your converted GPX lands in the wrong place and the numbers look like valid small lon/lat (tens and hundreds, not millions), check the lat/lon flip before you check anything else.
GPX has two schema versions in the wild, and knowing which you have changes how you parse it:
<url> and <urlname> for links, stored routes and tracks but with a slightly different element structure, and had no formal <extensions> mechanism. Namespace: http://www.topografix.com/GPX/1/0.<link> (replacing <url>/<urlname>), added <extensions> for vendor-specific data, added <time> on metadata, and standardised <rtept>/<trkpt> semantics. Namespace: http://www.topografix.com/GPX/1/1.For conversion purposes the differences rarely matter for geometry — both store lat/lon the same way — but they matter for metadata. A 1.0 file's links and names live in different elements than a 1.1 file's, so a converter that only understands 1.1 can silently drop a 1.0 file's names. Modern tools (togeojson, GDAL) handle both, but if you are writing your own parser, branch on the namespace in the root <gpx> element.
GPX points frequently carry <ele> (elevation in metres) and <time> (ISO 8601 UTC timestamp). These are what make a track a record rather than just a line. Good converters preserve them:
<ele> and <time> typically become feature properties (e.g. properties.ele, properties.time).<ExtendedData> or <altitude> for elevation and are dropped or stringified for time.longitude,latitude unless you ask for elevation and time columns.If your analysis depends on when or how high a point was recorded (speed from time deltas, slope from elevation deltas), make sure the target format and converter keep those fields, or pull them explicitly.
A single <trk> can contain several <trkseg> segments — for example, when a device lost signal and resumed. The correct GeoJSON representation is a MultiLineString (one LineString per segment) or, in looser converters, several LineString features. Our sample has one segment, so it is a single LineString, but be aware that a track with gaps should not become one continuous line with a straight "jump" across the gap. Confirm your converter emits a MultiLineString (or separate features) when segments are present; otherwise a straight line will falsely connect two disconnected pieces of your journey.
I converted the same 769-byte sample to all three targets and recorded exact sizes.
| Source | Format | Output size | Features |
|---|---|---|---|
simple.gpx (769 B) | GeoJSON | 1,365 B | 4 (2 LineString + 2 Point) |
simple.gpx (769 B) | KML | 1,627 B | 4 Placemarks |
simple.gpx (769 B) | CSV | 108 B | 4 rows (lon, lat) |

Figure 3. Exact byte counts for one GPX exported three ways.
Two things are worth knowing:
<coordinates> tags with extra structure, so its XML overhead exceeds GeoJSON's compact array syntax at this scale. The gap reverses for very large files (where GeoJSON's verbose text coordinates dominate), but for typical handheld exports KML is the bulky one.longitude,latitude — no markup, no properties — so it is the right choice when all you need is to plot or analyse points in a spreadsheet. At 108 B for 8 points, it is about an order of magnitude smaller than either structured format.Open the GPX to GeoJSON, GPX to KML, or GPX to CSV tool, drop your .gpx, and click Convert. The interface shows the loaded file, the source/target selectors, and the finished download.

Figure 4. The geoo.app converter with the real GPX loaded.
After conversion the download is ready:

Figure 5. The converted GPX output, ready to download — produced entirely in the browser.
Because the conversion runs in your browser via WebAssembly, your GPX never leaves your machine — useful when the file contains a client's survey points or a private route.
ogr2ogr (desktop)GDAL reads GPX directly, including its layered structure (it exposes waypoints, routes, and tracks as separate layers):
# GPX -> GeoJSON (one layer at a time; "tracks", "routes", or "waypoints")
ogr2ogr -f GeoJSON -sql "SELECT * FROM tracks" tracks.geojson simple.gpx
ogr2ogr -f GeoJSON -sql "SELECT * FROM waypoints" waypoints.geojson simple.gpx
If you omit the SQL, GDAL converts the first layer it finds; the -sql form lets you pick exactly which elements become features. This is the right tool when you need only the tracks, or only the waypoints, from a mixed file.
togeojson in Nodeconst { gpx } = require("@tmcw/togeojson");
const { DOMParser } = require("@xmldom/xmldom");
const fs = require("fs");
const xml = new DOMParser().parseFromString(
fs.readFileSync("simple.gpx", "utf8")
);
const geojson = gpx(xml);
console.log(geojson.features.length); // 4
When you have dozens of tracks from a season of fieldwork, convert them all at once with a shell loop:
mkdir -p geojson_out
for f in *.gpx; do
ogr2ogr -f GeoJSON "geojson_out/${f%.gpx}.geojson" "$f"
done
Each file becomes its own GeoJSON. If you would rather have one combined file, see the next section.
To merge many tracks into a single FeatureCollection (handy for showing a whole season on one map), concatenate after conversion:
const fs = require("fs");
const files = fs.readdirSync("geojson_out").filter(f => f.endsWith(".geojson"));
const features = files.flatMap(f =>
JSON.parse(fs.readFileSync(`geojson_out/${f}`)).features
);
fs.writeFileSync("all_tracks.geojson",
JSON.stringify({ type: "FeatureCollection", features }));
The browser route on geoo.app handles one file at a time, so for bulk merges the ogr2ogr/Node path above is the more practical choice.
A GPX-to-CSV export keeps the essentials: one row per point, with longitude and latitude columns (and usually name/elevation if present). For our sample the CSV is just:
longitude,latitude
-105.0,40.0
-104.5,40.5
-106.0,39.0
-105.5,39.5
-105.0,40.0
-107.0,41.0
-106.5,41.5
-106.0,42.0
That is the format spreadsheets, pandas, and most plotting tools want. If you only need to map or analyse the vertices, stop here — CSV is the smallest and most portable.
If you need elevation or time in the spreadsheet too, request (or post-process) extra columns. With ogr2ogr you can keep fields explicitly:
ogr2ogr -f CSV -select "ele,time,name" points.csv simple.gpx -sql "SELECT * FROM tracks"
This produces a CSV with ele, time, and name columns alongside the coordinates — useful when you want to compute speed (from time deltas) or slope (from ele deltas) without leaving the spreadsheet.
| Use case | Format | Why |
|---|---|---|
| Web maps, Leaflet/Mapbox, APIs | GeoJSON | native to JavaScript, keeps geometry + properties |
| Google Earth, sharing | KML | double-click to open, familiar to non-GIS users |
| Spreadsheets, quick plots | CSV | smallest, no markup, one row per point |
| Preserving device structure | keep GPX | it is the only one that separates tracks/routes/waypoints |
A practical pattern: keep the original GPX as your source of truth (it preserves track vs route vs waypoint, plus time and elevation), and derive GeoJSON/KML/CSV from it depending on who needs the file. You avoid re-extracting from the device, and you never lose the distinction between where you went and where you meant to go.
<trkseg> segments should become a MultiLineString or several LineString features. Confirm your converter does what you expect.<ele> and <time>. GeoJSON can preserve them as properties; CSV usually keeps only lon/lat unless you ask for more columns.<name> and <desc> typically become feature properties; symbol (<sym>) may or may not survive.<url>/<urlname>; 1.1 uses <link>. A 1.0-only file can lose names in a 1.1-only parser.Both GPX 1.1 files and many vendors embed extra data in an <extensions> element — heart rate, cadence, temperature, course, speed, and more (often under a gpxdata or vendor namespace). Standard converters usually ignore extensions, so if your analysis needs heart rate or speed, either use a tool that reads the specific namespace or parse <extensions> yourself after conversion. This is the main place where "my GPX has it but my GeoJSON doesn't" confusion comes from.
Is GPX already in WGS84? Almost always yes — GPX specifies latitude/longitude in decimal degrees. That is why it plots immediately, unlike CAD formats that live in projected metres.
Why does my GPX have no geometry after conversion? Usually a coordinate-order or namespace issue. Make sure the converter handles the GPX 1.1 namespace and flips lat/lon to lon/lat. A 1.0 file parsed as 1.1 (or vice versa) can also drop elements.
Can I convert GPX without uploading it? On geoo.app, yes — the conversion runs in your browser via WebAssembly, so the file never leaves your machine.
Track or route — which should I record? Record a track when you want the path you actually travelled (with time and elevation); plan a route when you want the path you intend to follow. They look similar on a map but mean different things, and a converter treats them identically as lines.
Why are my points in the ocean? Almost certainly a lat/lon vs lon/lat flip (Section 3.1). GPX is lat-then-lon; GeoJSON and web maps are lon-then-lat.
Will I keep elevation and time? In GeoJSON/KML, usually yes (as properties/ExtendedData). In CSV, only if you request those columns.
Can I convert only the tracks and ignore the waypoints? Yes — ogr2ogr with -sql "SELECT * FROM tracks" does exactly that; most browser converters export everything and you filter afterwards.
GPX 1.0 or 1.1 — does it matter? For geometry, barely. For metadata (names, links), yes; branch on the namespace if you parse it yourself.
How do I merge many GPX files? Convert each to GeoJSON, then concatenate their features into one FeatureCollection (Section 5.2), or use ogr2ogr with a VRT that lists all inputs.
Is GPX good for sharing with non-GIS friends? KML is friendlier for that (double-click opens in Google Earth); keep the GPX as your master and derive KML for sharing.
longitude, latitude (lon first)? If points are in the ocean, you have a lat/lon flip.Points and 1 route + 1 track become 2 LineStrings?ele/time survived.MultiLineString, not one continuous line.ele/time columns as needed.A GPX file is three things at once: waypoints (points), routes (planned lines), and tracks (recorded lines). The conversion to GeoJSON is mostly a matter of mapping those three elements to Point and LineString features, flipping lat/lon to lon/lat, and deciding which attributes (name, elevation, time) you want to keep. On our real 769-byte sample, that produced 4 GeoJSON features (2 lines + 2 points, 8 coordinates) weighing 1,365 B, a 1,627 B KML, and a 108 B CSV.
Keep the GPX as your master, derive the rest as needed, watch the lat/lon flip, and you will never lose the distinction between where you went and where you meant to go.
For the CAD side of the same "convert my field file" problem, the DWG to GIS guide covers DWG, KML and Shapefile. And if you are weighing container formats in general, the KML vs KMZ and DWG vs DXF comparison measures those trade-offs directly.