Geospatial data travels in many containers, but four cover the vast majority of everyday work: GeoJSON, KML, GPX and CSV. They are not competitors so much as tools for different jobs. Knowing which is which saves a lot of frustration.
GeoJSON โ the format of the web
GeoJSON is JSON with an agreed structure for geometry. A file contains features, each with a geometry (point, line, polygon and their multi- variants) and a bag of properties. It is the native language of web maps, JavaScript mapping libraries and modern spatial APIs.
- Strengths: human-readable, works directly in browsers, supported everywhere in web GIS, easy to generate and parse in code.
- Watch out for: coordinate order is always
[longitude, latitude]. Swapping them is the single most common GeoJSON bug.
KML โ the language of Google Earth
KML (Keyhole Markup Language) is an XML format created for Google Earth and still the standard for it. It carries not just geometry but styling: colours, icons, labels and 3D extrusions.
- Strengths: rich styling, opens directly in Google Earth and Maps, good for presentation.
- Watch out for: more verbose than GeoJSON; KMZ is just a zipped KML. Styling that looks good in Google Earth may be ignored by other software.
GPX โ the format of GPS devices
GPX (GPS Exchange Format) is an XML format built for tracks, routes and waypoints. If you record a hike, ride or survey path on a handheld GPS or phone app, you almost certainly get a GPX file.
- Strengths: the universal language of GPS units and fitness apps, carries timestamps and elevation per point.
- Watch out for: it models tracks and waypoints specifically, so arbitrary polygons do not map onto it cleanly.
CSV โ the humble spreadsheet
A CSV with latitude and longitude columns is the lowest common denominator. It is not really a spatial format, but everyone can open it, and it is the easiest way to move a list of points in and out of a spreadsheet or database.
- Strengths: opens in Excel, Google Sheets and every database; trivial to edit by hand.
- Watch out for: only naturally represents points. Lines and polygons have to be encoded some other way, such as WKT in a column, or reduced to a centroid.
Quick decision guide
- Building a web map or calling a spatial API? Use GeoJSON.
- Sharing something to open in Google Earth? Use KML.
- Loading points or a route onto a GPS device? Use GPX.
- Handing a point list to someone in a spreadsheet? Use CSV.
Converting between them
Because these formats overlap in what they can hold, converting is usually straightforward for points and lines. The main things to preserve are coordinate order (lon/lat for GeoJSON) and, where possible, feature properties. Our format converter reads any of the four, detects the source automatically, and writes the target format entirely in your browser so your data is never uploaded.
Try it: convert between GeoJSON, KML, GPX and CSV with the free Format Converter.