BYTETOOLS

KML to GeoJSON: Best Practices and Common Mistakes

To convert KML to GeoJSON cleanly, export plain KML rather than KMZ, trust the mandated [longitude, latitude] coordinate order, and plan ahead for how folders and polygon holes carry over. These are the details that separate a conversion that just works from one that silently drops data or crashes a web map. This is a best-practices reference for developers and analysts who already convert files and want fewer surprises.

Export the right file in the first place

Most conversion failures happen before conversion. Two habits prevent them:

  • Save as KML, not KMZ. KMZ is a zipped archive containing a doc.kml. A converter that expects raw XML can't read the zip directly. In Google Earth choose "Save Place As…" and pick the .kml extension. If you only have a KMZ, rename it to .zip, unzip, and convert the inner doc.kml.
  • Clean up before you export. Delete empty folders, temporary placemarks and image overlays you don't need. GeoJSON has no concept of overlays or screen graphics, so exporting them just produces noise you'll strip out later.

The coordinate-order trap

The most damaging mistake in the entire workflow is hand-swapping coordinates. The GeoJSON spec (RFC 7946) mandates [longitude, latitude] β€” the opposite of how humans say "lat, long," but the same order KML already uses in its lon,lat,alt tuples. So a correct converter never flips anything.

Libraries like Leaflet expect [lng, lat] in GeoJSON and flip to lat/lon internally. If you "fix" the order by hand, your points land in the wrong hemisphere or the ocean.

Rule of thumb: if your converted points appear off the coast of West Africa near 0Β°,0Β°, or mirrored across the equator, someone swapped the axes. Pass the GeoJSON through as-is and let the mapping library handle presentation.

Preserving structure: folders, holes and MultiGeometry

KML carries organizational and geometric detail that GeoJSON models differently. Knowing how each maps prevents lost data.

KML constructGeoJSON resultWatch out for
Folderfolder property on each featureGeoJSON has no folders β€” filter by the property to regroup
Polygon innerBoundaryIsExtra ring (a hole)Don't discard inner rings; donuts and lakes need them
MultiGeometryGeometryCollectionSome strict tools dislike mixed-type collections
name / descriptionFeature propertiesStyle-only ExtendedData may not survive

A frequent oversight is assuming folders vanish. They don't have to β€” this converter writes each enclosing folder's name into a folder property, so you can filter or group by it in QGIS, Leaflet or your own code to rebuild the original hierarchy.

Validate before you ship

KML from My Maps and older Earth versions can contain quirks β€” namespaces, CDATA-wrapped HTML descriptions, or styling that doesn't translate. After converting, do two checks: confirm the output is valid GeoJSON with a validator, and eyeball the feature count against the number of placemarks you expected. If a description was rich HTML, remember it becomes a plain property string, so escape or sanitize it before rendering in a popup. And because everything here is parsed by your browser's own XML engine, private property boundaries and site plans never leave your machine during any of this.

Try the KML to GeoJSON Converter β€” free and 100% in your browser.

FAQ

My converted points are in the wrong place β€” what happened?

Almost always a swapped coordinate order. GeoJSON requires [longitude, latitude]; if you or an intermediate step flipped it to [latitude, longitude], everything shifts. Use the converter's output unchanged and let your map library handle display.

Why won't my KMZ file convert?

KMZ is a zip archive, not XML. Rename it to .zip, extract the doc.kml inside, and convert that file. The geometry converts identically once you reach the raw KML.

Will I lose my Google Earth folder organization?

No, if the converter preserves it. Each feature gets a folder property holding its enclosing folder's name, so you can filter or group by that attribute to recreate the structure GeoJSON itself can't store.

Do polygon holes survive the conversion?

Yes. A KML outerBoundaryIs becomes the first GeoJSON ring and each innerBoundaryIs becomes an additional ring β€” exactly how GeoJSON represents holes, so donut zones and lakes stay intact.

Related free tools

Built by ByteVancer

ByteTools is a free product of ByteVancer, a software and web development studio building web apps, SaaS and custom software. If you're building a mapping app or a data pipeline that needs reliable format conversion, explore how ByteVancer can help.