GeoJSON to KML converter
Open a GeoJSON file in Google Earth or Google My Maps: this page writes it as a KML document with a placemark per feature. Free, and no account needed.
Convert GeoJSON to KML online, in your browser
GeoJSON in, KML out. The Spatibase GeoJSON to KML converter writes every feature of a GeoJSON file as a KML placemark, in your web browser. In detail:
- Labels Google Earth shows. A
nameproperty becomes the placemark’s name anddescriptionits balloon text; every other property is kept as ExtendedData. - Shapes unchanged. Both formats use WGS 84 longitude and latitude, so coordinates are copied as they are, altitude and polygon holes included.
- Private by design. The file never leaves your computer. Up to 50 MB, free, no sign-up.
How to convert GeoJSON to KML
- Get the GeoJSON. In QGIS: right-click the layer → Export → Save Features As, format GeoJSON. In geojson.io: Save → GeoJSON. In Overpass Turbo: Export → GeoJSON.
- Drop the
.geojsonor.jsonfile on the box above, or press Choose a file. The sample holds Barcelona places, a walking route and three areas. - Check the map. The notes under it say if any feature had no location or the coordinates had to be converted from Web Mercator.
- Press Download KML.
- Open it in Google Earth Pro with File → Open, import it into a project in Google Earth on the web, or add it to Google My Maps with Add layer → Import.
What the KML keeps from your GeoJSON
| What | What happens |
|---|---|
| Points, lines and polygons | Written as KML Point, LineString and Polygon. Polygon holes become innerBoundaryIs rings. |
| Multi-part shapes | MultiPoint, MultiLineString, MultiPolygon and GeometryCollection become one placemark with a MultiGeometry. |
| Altitude | Kept: a third coordinate is copied into the KML as it is. |
name property | The placemark’s <name>, the label on the map. Name and NAME work too. |
description property | The placemark’s <description>, shown in its balloon. A shapefile-style descriptio counts as well. |
| Other properties | One ExtendedData <Data> entry each, with numbers and true/false written as text. Empty (null) values are left out. |
| Nested objects and arrays | Written as JSON text, such as ["a","b"], inside one ExtendedData value. |
marker-color, stroke, fill | Kept as ExtendedData values, not turned into KML styles. Google Earth draws every feature in its default style. |
Feature id | Not carried over: a placemark gets only what’s in properties. |
| Features without geometry | Left out, with a count in the notes. A KML placemark needs a location. |
How a GeoJSON feature becomes a KML placemark
Same coordinates, different wrapping. GeoJSON and KML both store longitude first, then latitude, in WGS 84 degrees. So nothing is reprojected: [2.183801, 41.385831] becomes <coordinates>2.183801,41.385831</coordinates>.
The properties are where the two formats part ways. Google Earth treats three kinds of values differently:
- The name. KML has one label per placemark. Only a property called
namefills it; atitleorlabelstays an ordinary field, and the placemark shows without a label. - The description. Shown in the balloon when you click the placemark. Google Earth renders it as HTML, so a description holding markup shows formatted.
- Everything else. ExtendedData, KML’s free-form fields. Google Earth lists them in the balloon, and My Maps reads them as the layer’s table columns.
Beyond the properties, three cases need a second look:
- Colours. GeoJSON styles by convention (the simplestyle keys from geojson.io), KML by
<Style>elements. This converter keeps those keys as data, so restyle the layer in Google Earth or My Maps after opening it. - Web Mercator files. A legacy
crsmember naming EPSG:3857 is honoured: the metres are converted to degrees first, with a note. Any othercrsstops the conversion with its name, so export the data again as EPSG:4326. - A file that won’t open. A typo in the JSON stops the conversion, and features whose coordinates are empty or stored as text are left out. The GeoJSON validator on this site shows the line of each problem and turns text coordinates back into numbers in one click.
Convert GeoJSON to KML with ogr2ogr
GDAL’s ogr2ogr, included with QGIS, writes KML from the command line. Tell it which properties hold the label and the balloon text:
ogr2ogr -f KML places.kml places.geojson \
-dsco NameField=name -dsco DescriptionField=descriptionThe difference from this page: GDAL writes the other properties as typed SchemaData with a <Schema> instead of plain <Data>. Google Earth shows both; some older tools read only one.
In JavaScript, the tokml package does the same job: tokml(geojson, { name: 'name', description: 'description', simplestyle: true }). Its simplestyle option turns marker-color, stroke and fill into KML styles.
Questions about converting GeoJSON to KML
How do I open a GeoJSON file in Google Earth?
Convert it to KML first: drop the GeoJSON here and press Download KML. Then use File → Open in Google Earth Pro, or create a project in Google Earth on the web and import the KML file from your computer.
Can Google My Maps import GeoJSON?
No. My Maps takes KML, KMZ, GPX, CSV and spreadsheets, but not GeoJSON. Convert the file to KML here, then in My Maps choose Add layer → Import and pick the KML. Each layer holds up to 2,000 features.
Why do my placemarks have no names after converting GeoJSON to KML?
The KML label comes from a property called name (in any letter case). If your GeoJSON names things in title, label or NOMBRE, that value is kept as an ExtendedData field, but the placemark has no label. Rename the property to name before converting.
Are marker-color, stroke and fill kept in the KML?
As data, not as styling. The values stay in each placemark’s ExtendedData, and Google Earth draws the features in its default colours. Set the colours again in Google Earth or My Maps, or use a library such as tokml with its simplestyle option.
Do I need to swap latitude and longitude between GeoJSON and KML?
No. Both formats put longitude first and use WGS 84 degrees, so the coordinates are copied unchanged, including any altitude. If the map shows your data in the wrong place, the GeoJSON itself has them swapped; the GeoJSON validator can swap them back.
Does my GeoJSON get uploaded to make the KML?
No. Your browser reads the file and writes the KML on your computer. Nothing goes to Spatibase or any other server; only the background map tiles are loaded from the internet.
Moving the places into Spatibase? Read how to import your data. Need another pair of formats? The GIS file converter converts between all of them.