Converting KML to GeoJSON
This tool parses KML (Keyhole Markup Language) data and converts it to GeoJSON format. KML Placemarks become GeoJSON Features, and KML geometry elements (Point, LineString, Polygon, MultiGeometry) are mapped to their GeoJSON equivalents.
Simply paste your KML content into the input panel. The converted GeoJSON is displayed in the result panel and visualized on the map.
KML<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Placemark>
<name>Empire State Building</name>
<Point>
<coordinates>-73.9857,40.7484,0</coordinates>
</Point>
</Placemark>
</kml>What Gets Converted
- Placemarks: converted to GeoJSON Features with geometry and properties
- Coordinates: reordered from KML's
lon,lat,altto GeoJSON's[lon, lat]array format - Names and descriptions: preserved as Feature properties
- MultiGeometry: converted to appropriate Multi-type GeoJSON geometries
- ExtendedData: included in Feature properties when available
Limitations
KML features that do not have direct GeoJSON equivalents are not converted:
- Styling information (colors, icons, line widths), GeoJSON has no built-in styling
- Ground overlays and screen overlays, image-based features
- 3D altitude data, which GeoJSON supports but many consumers ignore
- Network links and dynamic content, GeoJSON is a static format
To convert in the other direction, use the GeoJSON to KML converter.
A Placemark, Converted
Paste this KML containing a Placemark for the Sydney Opera House. The converter produces a GeoJSON Feature with the name preserved as a property:
KML<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Placemark>
<name>Sydney Opera House</name>
<description>Iconic performing arts venue</description>
<Point>
<coordinates>151.2153,-33.8568,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>The resulting GeoJSON output:
GeoJSON{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"name": "Sydney Opera House",
"description": "Iconic performing arts venue"
},
"geometry": {
"type": "Point",
"coordinates": [151.2153, -33.8568, 0]
}
}
]
}The KML <name> and <description> elements become properties on the Feature. The altitude is kept as a third position value, which RFC 7946 permits and reads as elevation in metres.
That third value is worth knowing about, because a great deal of KML carries a meaningless 0 there from an export default. Most renderers ignore it, but some consumers reject three-element positions outright, so strip it if a downstream tool complains.
Inside the KML Parser
The converter parses the KML XML document and extracts every Placemark element. Each Placemark's geometry is read from its child element (Point, LineString, Polygon, or MultiGeometry) and converted to the equivalent GeoJSON geometry type. KML coordinate strings (lon,lat,alt) are split and restructured into JSON arrays.
After conversion, you can view the result on a map, validate it against RFC 7946, or process it with any of the other GeoJSON tools. For more on the GeoJSON format and its rules, see the GeoJSON Specification Guide.
What This Converter Does Not Take
KMZ archives. A .kmz is a zip containing a KML document plus its icons, overlays and models. This tool reads plain XML only, so unzip the archive and paste the doc.kml from inside it. The referenced assets have no GeoJSON equivalent in any case.
Folder structure. KML organises Placemarks into nested <Folder> elements, which is how Google My Maps models layers. The conversion flattens all of them: every Placemark becomes a sibling Feature and the folder names are not carried across. If you need the grouping, split the KML by folder before converting, or add a property yourself afterwards.
Network links and time spans. A <NetworkLink> points at data held elsewhere and is not followed. <TimeSpan> and <TimeStamp> elements are dropped, so an animated KML tour becomes a static set of features.
Common Gotchas When Migrating from KML
- Coordinate order in KML is
lon,lat,altas a comma-separated string with no whitespace inside a coordinate triple. Multiple coordinates are separated by whitespace, not commas. The converter parses both styles you'll see in the wild, but if you're hand-editing KML by hand, this is the rule. - Altitude is the third coordinate position in KML and is preserved in GeoJSON output as a third element when present. Most web maps ignore the altitude; PostGIS and CesiumJS will use it. RFC 7946 explicitly permits 3D coordinates but warns that consuming applications may discard them.
- Polygon rings in KML use
<outerBoundaryIs>and<innerBoundaryIs>. The converter maps these to GeoJSON's outer-then-inner ring array convention. KML doesn't enforce winding order; the output is rewound to RFC 7946's right-hand rule (exterior CCW, holes CW). - Time-stamped placemarks (
<TimeStamp>,<TimeSpan>) are extracted intostartandendproperties as ISO 8601 strings, useful for tools like kepler.gl that animate features along a time axis. - Styling tags drop on the floor.
<Style>,<StyleMap>, and inline<styleUrl>references don't survive the conversion because GeoJSON has no styling vocabulary. If you need to preserve styling, encode it as properties (fill-color,stroke-width) and apply it client-side with simplestyle-spec or your mapping library's own styling pass.