TrailCam

Guides

GPX vs GeoJSON for trail data: which one fits a hike?

GPX and GeoJSON both come down to a list of coordinates in the end, but they were built to answer different questions. GPX exists specifically to describe a GPS recording — a track, its elevation, the time each point was logged. GeoJSON exists to describe any shape on a map at all — a hiking route, a building outline, a country border — using the same handful of geometry types for all of them. That difference in scope is small on paper and surprisingly easy to trip over once you actually try to move a recorded hike between the two.

What each format is built for

GPX is built for one thing: a GPS track

GPX has a fixed, purpose-built structure for exactly this job — a track made of points, each with a latitude, longitude, usually an elevation and a timestamp, plus optional standalone waypoints. Every field in the format exists because a GPS recording needs it. There is nothing to configure and nothing generic about it.

GeoJSON is built for any kind of map data

GeoJSON is a general-purpose way to describe shapes on a map — points, lines, polygons — encoded as plain JSON, and it is everywhere in web mapping and GIS software precisely because it is not tied to any one kind of data. A hiking route becomes a "LineString"; so would a building footprint, a lake outline, or a country border, using the exact same structure. That flexibility is the whole appeal for a web map with a dozen different kinds of features on it. For a single recorded hike, it means the format has no built-in idea of what a "track" even is — a hike is just one line among the shapes GeoJSON knows how to hold.

What a hike loses going into GeoJSON

GeoJSON has no dedicated field for time at all. A GPX track point carries a timestamp as a matter of course; a GeoJSON coordinate is just numbers — longitude, latitude, and optionally elevation, with nothing else attached to it by the format itself. A converter that wants to keep timestamps has to invent somewhere to put them, usually as an array tucked into the feature's freeform "properties" object, which is a workaround rather than a standard — a different tool reading the same file has no guaranteed way to know that array is even there, let alone what it means.

Elevation survives more cleanly, as an optional third number after longitude and latitude in each coordinate, but that ordering itself is a common trap: GeoJSON always writes longitude before latitude, the reverse of how people usually say a coordinate out loud, and the reverse of the order GPX uses in its own attributes. A conversion that gets that swap wrong does not fail loudly — it just plots the route somewhere else on the globe entirely, or upside down relative to how it should sit.

Why that matters for a hike

Hiking and cycling platforms — Strava, Garmin Connect, Komoot, Gaia GPS, CalTopo — are built around GPX. They expect a track with timestamps intact, because moving time, pace and a replay of the walk all depend on knowing when each point was logged, not just where it was. Hand one of these a GeoJSON file and, at best, it imports the shape of the route with none of the timing that made it a recorded hike rather than a drawn line; at worst, it is not accepted at all.

GeoJSON's home ground is different: web maps, GIS software, and anywhere a route needs to sit alongside other kinds of geographic data rather than stand alone as an activity. A custom map on a website, a QGIS project laying trails over property boundaries, a route previewed straight in a GitHub repository — all of that reads GeoJSON natively and has no particular use for GPX's timestamps in the first place.

Side by side

  • Purpose: GPX is built specifically for GPS tracks. GeoJSON is a general-purpose format for any shape on a map.
  • Timestamps: GPX carries one per point as a core field. GeoJSON has no dedicated field for time at all.
  • Coordinate order: GPX writes latitude before longitude in its attributes. GeoJSON always writes longitude before latitude — a common source of swapped, misplaced routes.
  • Origin: GPX is an open, vendor-neutral format published in 2002 for GPS data specifically. GeoJSON was formalised later as a general web-mapping and GIS standard.
  • Compatibility: GPX opens natively in essentially every hiking, cycling and mapping platform. GeoJSON opens natively in web maps and GIS tools, and more narrowly in fitness platforms built around activities.
  • Best fit: GPX for a recorded hike you want timing, pace and replay to survive. GeoJSON for a route displayed on a custom web map or analysed alongside other GIS layers.

Converting between them

GPX to GeoJSON is a common, well-supported conversion — tools such as GPSBabel and a number of free browser-based converters handle it in one pass, and the shape of the route survives intact. What you get afterward depends on the tool: some quietly drop the timestamps, others tuck them into the properties object where a receiving tool may or may not look for them, so it is worth checking the output if the timing matters to what comes next.

Going the other way, GeoJSON to GPX, works cleanly for the coordinates themselves, but a converter can only put back timestamps that were preserved somewhere in the GeoJSON to begin with. A GeoJSON file that never carried timing information — which is most of them, since GeoJSON does not require it — converts to a GPX track with no timestamps at all: a correct line on the map, but not something a platform expecting moving time or pace can do much with.

What TrailCam exports

TrailCam exports a recorded route as GPX 1.1 or as a CSV summary; it does not produce GeoJSON. For a hike, GPX is the format built to keep what actually makes it a recording rather than a drawn line — the timestamp on every point, which is what lets moving time, pace and elevation gain get calculated at all, and what lets Strava, Garmin Connect or Komoot read the file with nothing lost. Export is part of the optional TrailCam Pro upgrade; the app itself is free to download.

Questions

Is GeoJSON better than GPX for a hike?
Not for keeping a recorded hike intact. GeoJSON has no dedicated field for timestamps, so a converted track loses the timing that moving time, pace and elevation gain are calculated from, unless a converter goes out of its way to preserve it in a non-standard way. GPX carries that timing as a core part of the format.
Why does my route end up in the wrong place after converting to GeoJSON?
Most often a coordinate-order mix-up. GeoJSON always writes longitude before latitude; GPX's own attributes go the other way round. A converter or a hand-written script that gets that swap wrong plots the route somewhere else on the globe rather than failing with an error.
Does TrailCam export GeoJSON?
No. TrailCam exports GPX 1.1 or a CSV summary, which keep the timestamp on every point — what Strava, Garmin Connect and Komoot all expect, and what a replay of the walk depends on.

Recording your own routes

TrailCam is an iPhone app that records your route with GPS, keeps video clips, photos and voice notes pinned to the spot where you took them, and exports the result as GPX 1.1 or CSV. It is free to download.

Download on the App Store