# 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.

Open the tool: https://spatibase.com/tools/geojson-to-kml/

**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 `name` property becomes the placemark’s name and `description` its 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.

## What it does
- Convert a GeoJSON FeatureCollection, a single Feature or a bare geometry to KML
- Uses the name and description properties as placemark labels
- Writes every other property as KML ExtendedData
- Keeps altitude, polygon holes and multi-part shapes
- Converts a legacy EPSG:3857 crs member to longitude and latitude
- Opens in Google Earth Pro, Google Earth on the web and Google My Maps
- Runs in the browser: nothing is uploaded

## How to convert GeoJSON to KML
1. 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.
2. Drop the `.geojson` or `.json` file on the box above, or press Choose a file. The sample holds Barcelona places, a walking route and three areas.
3. Check the map. The notes under it say if any feature had no location or the coordinates had to be converted from Web Mercator.
4. Press Download KML.
5. 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.

## Formats and limits
- **Opens:** .geojson or .json, up to 50 MB. Other map files (KML, KMZ, GPX, GeoJSON, shapefile, CSV) convert too.
- **Downloads:** KML, GeoJSON, CSV of the same features.
- **Privacy:** the file is read in your browser and never uploaded.
- Try it with a sample: https://spatibase.com/tools/geojson-to-kml/?sample=1
- Download the sample file (the one Open a sample opens): https://spatibase.com/tools/samples/barcelona.geojson

## 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 `name` fills it; a `title` or `label` stays 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 `crs` member naming EPSG:3857 is honoured: the metres are converted to degrees first, with a note. Any other `crs` stops 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:

```bash
ogr2ogr -f KML places.kml places.geojson \
  -dsco NameField=name -dsco DescriptionField=description
```

**The 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.

## Frequently asked questions
### 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.

## Next step
Turn the file into a live map your team can edit: **Save to Spatibase (free)** on the page saves it to a free Spatibase project (https://app.spatibase.com/signup), your places on a map you can edit and a live GeoJSON address for your site. Or download the GeoJSON and import it by hand (https://spatibase.com/docs/content/import/).
