Why convert KML to GEOJSON?
KML is an XML-based geographic format (introduced 2004, adopted as an OGC standard in 2008) commonly produced by Google Earth and Google My Maps. GeoJSON is a JSON-based geospatial format (IETF RFC 7946, 2016) natively supported by web mapping libraries and rendered directly by GitHub. Converting from KML to .geojson is typically done to make location data usable on the web without a dedicated GIS client.
How to convert KML to GEOJSON
QGIS FREE
Add the .kml file as a vector layer, then right-click the layer and choose Export > Save Features As, setting the format to GeoJSON.
ogr2ogr OPEN-SOURCE
Run ogr2ogr -f GeoJSON output.geojson input.kml; ogr2ogr also reads .kmz files directly without unzipping.
About these formats
A KML file stores map data - pins, routes, polygons, image overlays - in plain XML format. The easiest way to open one is Google Earth (free desktop app or earth.google.com in a browser) or…
Open .KML details →A GEOJSON file stores geographic features - points, lines, and polygons with their attributes - as plain JSON text, and it is the standard format for web mapping. To view it on a map…
Open .GEOJSON details →Quality & what to watch
- Geometry (points, lines, polygons) transfers accurately; KML styling (colors, icon sizes, label styles) is lost and must be defined separately in the target mapping application.
- KML folders and placemarks may map to separate feature collections depending on the tool and flags used.
- KML NetworkLink elements referencing live remote data are not followed; only static geometry in the file is exported.
Frequently asked questions
Does ogr2ogr handle KMZ files too?
.kmz (a zipped KML) directly, so there is no need to unzip before converting.