GIS File Formats Explained — GeoJSON, KML, Shapefile, and GPX Compared
Geographic data has a format problem. The web standardized on GeoJSON, Google built its ecosystem on KML, professional GIS spent thirty years accumulating Shapefiles, and every GPS device and fitness app exports GPX. All four describe points, lines, and polygons on the Earth, yet none of them opens everywhere. If you work with maps, you convert between these formats constantly, and each conversion has traps worth knowing about in advance.
GeoJSON — The Web Native
GeoJSON (RFC 7946) stores features as plain JSON: a geometry (Point, LineString, Polygon, or their Multi- variants) plus a properties object holding any attributes you like. Because it is just JSON, every programming language parses it without a library, and every modern web mapping tool (Leaflet, Mapbox GL, OpenLayers, D3) renders it natively. It is the default answer for anything that runs in a browser or an API.
Two things to know. First, the spec requires WGS84 coordinates in longitude, latitude order, which is the reverse of how humans say coordinates and the reverse of KML labels. Feeding latitude-first data into a GeoJSON pipeline puts your points in the ocean; it is the single most common GIS bug. Second, GeoJSON carries no styling: colors and icons live in the application, not the file.
KML — The Google Earth Format
KML is XML designed for Google Earth, and it bundles two things GeoJSON deliberately leaves out: presentation and structure. A KML file can define icon styles, line colors, balloon templates, folder hierarchies, even camera fly-to positions. That makes it excellent for sharing a finished, styled map with a non-technical audience: they double-click the file and Google Earth shows exactly what you designed.
The cost is attribute handling. KML stores data either as free-form HTML in a description balloon or in an ExtendedData block, and tools are inconsistent about which they write and read. Converting KML to GeoJSON or CSV preserves ExtendedData fields cleanly, but attributes buried in HTML descriptions come across as one blob of markup. Styling is dropped entirely when leaving KML, because the target formats have nowhere to put it.
Shapefile — The Thirty-Year Standard
The Esri Shapefile dates to 1992 and remains the de facto exchange format of desktop GIS. It is not one file but a bundle: .shp holds geometry, .dbf holds the attribute table, .shx is a spatial index, and .prj declares the coordinate system. Ship all of them together (usually zipped) or the recipient gets geometry with no attributes, or worse, data in an unknown projection.
Shapefile's age shows in its limits, and conversions run into all of them: column names are capped at 10 characters (longer GeoJSON property names get truncated, silently, with numbered suffixes on collisions), a single file tops out at 2GB, text fields max out at 254 characters, and there is no boolean or null concept. A shapefile also holds exactly one geometry type, so converting a GeoJSON that mixes points and polygons produces multiple shapefiles or drops features. When these limits bite, they bite quietly; check your attribute table after converting.
GPX — Tracks and Waypoints
GPX is the narrowest of the four: an XML format for GPS data, structured as waypoints, routes (planned paths), and tracks (recorded paths with timestamps, and often elevation and heart-rate extensions). It is what Garmin devices, Strava, Komoot, and virtually every outdoor app export. Convert GPX to GeoJSON when you want to put a hike on a web map, or to CSV when you want to analyze pace and elevation in a spreadsheet: each track point becomes a row with its coordinates, elevation, and timestamp.
Format Comparison
| Format | Structure | Attributes | Styling | Best for |
|---|---|---|---|---|
| GeoJSON | Single JSON file | Unlimited, typed | None | Web maps, APIs, code |
| KML | Single XML file | ExtendedData block | Full (icons, colors) | Google Earth, sharing styled maps |
| Shapefile | Multi-file bundle | 10-char names, 254-char text | None | Desktop GIS, legacy pipelines |
| GPX | Single XML file | Fixed schema + extensions | None | GPS devices, fitness apps |
Conversion Gotchas Checklist
Coordinate order: GeoJSON is longitude-first; most people think latitude-first. If converted points land in the wrong hemisphere, this is why. Projections: GeoJSON and KML are always WGS84, but Shapefiles can be in any coordinate system; a conversion without the .prj file has to assume, and may assume wrong. Attribute truncation: GeoJSON to Shapefile shortens property names to 10 characters. Styling loss: KML to anything drops colors and icons. Geometry mixing: Shapefile cannot hold mixed geometry types in one file. None of these are bugs in any particular converter; they are limits of the formats themselves, and every tool that converts honestly has to make the same choices.
Convert between GeoJSON, KML, Shapefile, GPX, and CSV in the browser. Attributes preserved, powered by GDAL.
Browse GIS Tools