October 12, 2025 · 6 min read · MapBench editorial
KML vs. GeoJSON vs. GPX: Choosing the Right Map File Format
Three formats dominate consumer geographic data: KML from the Google Earth era, GeoJSON from the web-mapping world, and GPX from GPS devices. All three can carry points, lines and polygons — but they differ in what metadata survives, how they parse, and where they're welcomed.
GeoJSON — the developer's default
- Plain JSON: trivial to parse, diff and version-control.
- Native to MapLibre, Leaflet, Mapbox, deck.gl and most web GIS.
- Properties are free-form key/value — great for data-driven styling.
- No official coordinate reference system field: it's WGS84 by convention.
KML — the Google ecosystem format
- XML-based; the native format of Google Earth and My Maps exports.
- Supports styling, folders, ground overlays and time spans.
- KMZ is simply a zipped KML (often with images).
- Parsing is heavier and quirks like ExtendedData take care.
GPX — built for tracks
- The universal exchange format of GPS devices: Strava, Garmin, Komoot, drones.
- Three structures: waypoints (wpt), tracks (trk) and routes (rte).
- Per-point elevation and timestamps are first-class.
- No polygons — GPX is not the format for areas.
What conversion loses
GeoJSON → GPX keeps points as waypoints and lines as tracks, but polygons degrade to boundary tracks and arbitrary properties are dropped. KML → GeoJSON keeps geometry and ExtendedData but usually drops visual styling. GPX → GeoJSON is essentially lossless for geometry, and preserves elevation as a third coordinate. When in doubt, keep an original copy of the source file.
The toolkit behind this post, in depth
GeoJSON Viewer
Drop a .geojson file — or paste raw GeoJSON text — and this workbench validates the structure, reports the feature count by geometry type, draws everything on an interactive map and lists every feature for property inspection on click. Points, MultiPoints, lines, MultiLines, polygons, MultiPolygons and GeometryCollections are all supported, exactly per spec. Invalid JSON gets a precise, human error (trailing commas and unquoted keys are named offenders) instead of a silent failure.
The privacy guarantee is architectural: parsing happens in your browser via FileReader and DOMParser, and the file never touches a server — check the network tab to verify. When you need other ecosystems, one-click exports convert to KML or GPX with names and properties preserved as far as each format allows, and GeoJSON re-download normalises what you pasted. Bounding-box zoom frames any dataset instantly. It is the first stop for QA on exports from QGIS, Mapshaper, Felt or any API you trust slightly less than you should.
KML Viewer
KML remains the export format of Google Earth, Google My Maps and a decade of saved places. Drop a .kml file here and every placemark, line and polygon renders on an interactive map, with names, descriptions and ExtendedData preserved and inspectable per feature. Layer visibility toggles keep busy files readable, the bounding box zoom frames the whole dataset, and clear errors explain empty or malformed files — including the classic KMZ trap: a KMZ is a ZIP archive, so unzip first and drop the .kml inside.
All parsing is local — DOMParser in your browser, nothing uploaded — which matters when the file contains client sites, survey points or unpublished plans. When the data needs to move on, one click exports GeoJSON for web GIS or GPX for devices, carrying geometry and properties across. Colours render with sensible defaults rather than mimicking Google's styling engine, and the page says so. For the reverse direction, or for track-heavy files, the sibling GPX and GeoJSON viewers complete the family.
GPX Viewer
Open a GPX file from a bike computer, hiking app, drone or handheld and the tool draws every track, route and waypoint on the map and computes the full stat sheet: total distance, elevation gain and loss, minimum and maximum elevation, and duration whenever timestamps exist. An elevation profile chart shows the shape of the day, with the same local, private parsing as the rest of the file tools — your activity never leaves the browser.
Methodology notes keep the numbers honest: gain sums positive differences between consecutive trackpoints, and raw GPS elevation is noisy, so gain figures can look inflated — that is the source data, not the math. Missing timestamps are reported as missing rather than faked. Conversions export the same geometry as GeoJSON or KML, and a cleaned GPX re-download normalises the file for other apps. Pair it with the elevation profile tool to compare a recorded track against terrain truth from the Copernicus DEM.
CSV to Map
Upload or paste a CSV containing latitude and longitude columns and this tool maps it instantly: coordinate columns are auto-detected from headers (lat/latitude/y, lng/lon/longitude/x and friends) but always overridable by dropdown, an optional label column feeds popups and an optional category column colours the points with a legend. Marker clustering keeps tens of thousands of rows fluid, and skipped rows — invalid or out-of-range coordinates — are counted and reported rather than silently dropped.
Everything runs locally: parsing, clustering, rendering, export. The result leaves your browser as GeoJSON or KML for GIS use, or back as CSV after you have confirmed which columns meant what. Typical jobs include plotting store lists, visualising sensor logs, checking a geocoding batch for offshore mistakes, and turning survey responses into a map for a report. When the data starts as GPX or KML instead, the sibling viewers convert it into the same pipeline; for hand-placed points, the pin map is the lighter instrument.
KML, GeoJSON, GPX: the three dialects of geographic data
Three formats carry most consumer geographic data, and each reflects its ancestry. KML is XML from the Google Earth era: folders, styling, descriptions and ExtendedData, beloved by saved-place collections. GeoJSON is plain JSON from the web-mapping world: trivial to parse, diff and version, native to every modern map library, properties free-form. GPX is the GPS device format: waypoints, tracks and routes, with per-point elevation and timestamps as first-class citizens. Conversions between them are mostly faithful for geometry and lossy for everything else — polygons degrade to boundary tracks in GPX, styling evaporates into GeoJSON, and a wise workflow always keeps the original file.
Because these files are often personal — tracks, client sites, survey points — the right place to open them is your own browser. Parsing with built-in readers (FileReader, DOMParser, JSON.parse) means nothing is uploaded, ever, and validation errors can be precise: trailing commas, unquoted keys and KMZ-inside-ZIP confusion are all detectable and explainable locally. A trustworthy viewer tells you exactly what it understood: feature counts by geometry type, property tables, bounding boxes.
GPX deserves special respect for its elevation story. Gain and loss are sums of positive and negative differences between consecutive trackpoints, and raw GPS elevation is noisy, so honest tools show the profile and the caveats together. Duration appears only when timestamps exist; when they don't, the right behaviour is to say so rather than invent a clock. Data hygiene, like privacy, is a feature you can feel.
A professional workflow for geographic files
Treat every incoming geographic file as untrusted until inspected: open it locally, read the validation report, check feature counts by geometry type, and eyeball the bounding box before doing anything else. A bounding box spanning the planet usually means one corrupt vertex; a box in the wrong hemisphere means swapped axes; an empty box means the parser and the file disagree about what a coordinate is. Thirty seconds of inspection prevents most downstream embarrassments, and doing it in-browser keeps confidential data confidential.
Conversions then become deliberate acts with known losses. To GPX you take points and lines, leaving polygons as boundary tracks and dropping rich properties; to KML you gain presentation and lose nothing you needed computationally; to GeoJSON you keep the data and shed the styling. Name the loss on the way out, keep the original on disk, and your pipeline stays auditable — which is the entire difference between a hobby workflow and a professional one.
- Inspect before converting: counts, bounding box, and three random property rows, every time.
- Keep originals forever; conversions are lossy at the edges and cheap to re-run.
- For CSV imports, confirm the detected lat/lng columns against a known point before mapping all rows.
- Rename exports with date + source + format; filenames are the metadata you'll actually read later.
Honest limits & when to escalate
The file tools' limits are format-inherent and honestly named. GPX carries time and elevation but not polygons or rich properties; KML carries presentation but ages into XML quirks; GeoJSON carries data but no styling; CSV carries anything and guarantees nothing. Conversions therefore always have a named loss, and the professional move — keep the original, export the derivative — is recommended on every export panel. A second boundary is source quality: a track's elevation is only as calm as the receiver that logged it, and a CSV's coordinates are only as sane as the column that birthed them; the viewers show counts, boxes and skipped-row tallies so those truths surface immediately.
What remains after those limits is a genuinely complete local workbench: validation, inspection, measurement, conversion and export, with zero upload. The escalation path is about scale and authority rather than privacy — national cadastral formats, laser-scan point clouds and billion-row rasters belong to GIS workstations; everything a laptop holds is welcome here, and the honesty labels travel with it.
- Cadastral/legal formats → jurisdictional land-registry exports.
- Point clouds and rasters → desktop GIS with proper spatial indexes.
- Certified tracks (evidence, insurance) → chain-of-custody originals, untouched.
- Enterprise pipelines → scripted parsers with schema validation.
Step-by-step masterclass
- Inspect before trusting — Open locally, read the validation line, check feature counts and the bounding box; a planet-spanning box means one corrupt vertex, a wrong-hemisphere box means swapped axes.
- Sample properties by eye — Three random rows of properties catch encoding and column-shift bugs no schema check will flag.
- Choose the conversion by its loss — GPX keeps time/elevation, KML keeps presentation, GeoJSON keeps data; name the loss on the way out and keep the original regardless.
- Confirm CSV columns against a known point — Auto-detection is good, not magical; verify the detected lat/lng pair on the map before rendering all 40,000 rows.
- Export with meaningful names — Date + source + format in the filename; filenames are the metadata future-you will actually read.
Format culture follows tooling: Google-era workflows still circulate KML, GPS and sport apps speak GPX, and the analytical web has standardised on GeoJSON — so a privacy-first converter that handles all three locally is effectively a universal adapter for a decade of saved places.
Tips & common mistakes
Keep the original file even after converting: GPX→GeoJSON drops timestamps' context, KML→GeoJSON drops styling, and every pipeline has a lossy edge. Originals are cheap; re-acquisition is not.
Validate before trusting exports from unfamiliar tools — open them in a local viewer and check feature counts, bounding boxes and a few property rows. A wrong-axis or swapped-coordinate export is far easier to catch on a map than in a spreadsheet.
For big CSVs, fix the coordinate columns first and map a sample before mapping everything: auto-detection is good but not magical, and one swapped column renders a beautiful map of the wrong ocean.
Quick glossary
- GeoJSON: JSON geographic format; the web-mapping native dialect.
- KML: XML format from the Google Earth era, with styling and ExtendedData.
- GPX: GPS exchange format: waypoints, tracks, routes, elevation, timestamps.
- Bounding box: The minimal rectangle enclosing a dataset; the instant sanity check.
Two more questions, answered
Why no KMZ directly?
KMZ is ZIP-in-disguise; unzipping exposes the KML and keeps the whole pipeline transparent and local.
Do exports keep my styling?
Geometry and properties travel; exact visual styling is format-private by design — that's the named loss.