Docs › Formats › KML / KMZ

KML and KMZ

KML is Google's XML-based format for geographic data, originally created for Google Earth and now an OGC standard. KMZ is a zipped KML. KML emphasises display (icons, styles, balloons) over attributes, so it's most useful for handing files to viewers like Google Earth, mobile mapping apps and Google My Maps — as a data interchange format it has weaker attribute typing and schema support than GeoJSON or Shapefile.

File extensions: .kml, .kmz · Read: ✓ · Write: ✓ · Multi-layer:

CLI examples

mapshaper places.kml -info
mapshaper places.kmz -o format=geojson places.geojson
mapshaper provinces.shp -proj wgs84 -o provinces.kml

Format-specific input options

There are no KML-specific -i options. Encoding is always UTF-8 per the KML spec.

Format-specific output options

There are no KML-specific -o options.

Practical notes

  • KML stores all attribute values as strings, so numeric attributes are imported as strings.
  • KML requires WGS84 coordinates, but Mapshaper does not reproject on export — coordinates are written through as-is. If your dataset is in any other CRS, run -proj wgs84 first, otherwise the output will not be conformant KML and viewers will misplace the geometry.

External resources