Map files & formats · 5 min
Map file formats, explained
Shapefile, GeoJSON, KML, GPX: what each one is for and the traps when you convert.
Map files & formats
Different apps, different files
A map file stores shapes (points, lines, areas) and facts about each one, like a name or a population. The formats differ in who made them and where they are used.
GIS programs swap Shapefiles. Websites use GeoJSON. Google Earth uses KML or KMZ. GPS watches and hiking apps use GPX.
Lesson notes
Everything from the cards above, on one page to come back to.
Different apps, different files
A map file stores shapes (points, lines, areas) and facts about each one, like a name or a population. The formats differ in who made them and where they are used.
GIS programs swap Shapefiles. Websites use GeoJSON. Google Earth uses KML or KMZ. GPS watches and hiking apps use GPX.
A Shapefile is several files
Despite the name, a Shapefile is a set of files with the same name: .shp holds the shapes, .shx an index, .dbf the table of facts and .prj the projection.
Send only the .shp and the other person gets shapes with no names, no data and no idea where on Earth they belong. Always zip the whole set together.
parcels.shp + parcels.shx + parcels.dbf + parcels.prj → parcels.zip
GeoJSON flips the order
GeoJSON is plain text, so websites and code can read it easily. Its standard says coordinates are in longitude, latitude order, always in WGS 84 (ordinary GPS degrees).
That is the opposite of what you paste from Google Maps. Swapped coordinates are the most common reason a point shows up in the wrong country, often in Antarctica or the sea.
Paris in GeoJSON: [2.2945, 48.8584] (longitude first)
Questions
What is the difference between KML and KMZ?
KMZ is a KML file zipped up, sometimes with images inside. Google Earth opens both.
Why did my points end up in the wrong place after converting?
Usually latitude and longitude were swapped, or the projection was missing or wrong. Check the .prj of a Shapefile, and remember GeoJSON stores longitude first.