KML & KMZ viewer

Open a KML or KMZ file, see it on a map and convert it to GeoJSON or CSV. Free, and no account needed.

Drop a KML or KMZ file here

Download the sample

Your file stays on your computer: nothing is uploaded.

In short

A free KML viewer that runs in your browser

The Spatibase KML & KMZ viewer opens KML and KMZ files in your web browser, shows their places, lines and areas on a map, and converts them to GeoJSON and CSV, and a KMZ to the KML inside it. It’s free with no account and no sign-up, and your file is read on your computer, never uploaded.

What to expect from the file:

  • Kept. Names, descriptions, folders and extra data (ExtendedData).
  • Skipped, and counted. Photos, icons and image overlays are left out, and the viewer says how many. Network links (data online) are not fetched.
  • Limit. Files up to 50 MB.
How to

How to open a KMZ or KML file

Five steps, and it all happens in this page.

  1. Export your map as KML or KMZ. In Google My Maps: the three-dot menu → Export to KML/KMZ. In Google Earth: right-click a folder → Save Place As.
  2. Drop the file on the box above, or press Choose a file. No file at hand? Open a sample, or download the sample file to open it in Google Earth too.
  3. Look at the map. Click a place to see its name and description.
  4. Check the list under the map. Click a row to jump to that feature.
  5. Download it as GeoJSON or CSV, or copy the GeoJSON. For a KMZ you can also download the KML inside it.
Formats

KML vs KMZ: what is the difference?

The difference is the packaging:

  • KML is plain text. A .kml file is XML that lists places, lines and areas with their names, descriptions and styles. Google Earth made the format popular, and Google My Maps exports it too.
  • KMZ is a zipped KML. A .kmz holds the KML (usually doc.kml) and sometimes the photos, icons and image overlays it uses. To convert KMZ to KML, the viewer unzips it and gives you the KML inside, unchanged.

What the viewer shows. The places, lines and areas in the KML itself. Icons, photos and image overlays (GroundOverlay) are skipped, and it tells you how many.

For developers

Convert KML to GeoJSON in JavaScript

The viewer uses two small open-source libraries: @tmcw/togeojson reads KML, and fflate unzips KMZ. These lines do the same job in your own code, in a browser.

import { kml } from '@tmcw/togeojson'
import { unzipSync, strFromU8 } from 'fflate'

// file: a File from <input type="file">
const bytes = new Uint8Array(await file.arrayBuffer())
let text = strFromU8(bytes)
if (bytes[0] === 0x50 && bytes[1] === 0x4b) { // "PK": a KMZ is a zip
  const files = unzipSync(bytes, { filter: (f) => f.name.endsWith('.kml') })
  text = strFromU8(files['doc.kml'] ?? Object.values(files)[0])
}
const geojson = kml(new DOMParser().parseFromString(text, 'text/xml'))

In Node.js. There is no DOMParser: pass the text to the one from @xmldom/xmldom instead.

FAQ

Questions about KML and KMZ files

Is my file uploaded?

No. The file is read by your browser, on your computer. Nothing is sent to Spatibase or anyone else. Only the map background (the streets and labels) is loaded from the internet.

What is a KMZ file?

A KMZ is a zipped KML file. It contains the KML (often doc.kml) and sometimes the photos and icons it uses. The viewer opens it directly, and Download KML gives you the KML inside.

Why don’t I see my photos, icons or image overlays?

The viewer shows the places, lines and areas in the file, with their text. Photos, custom icons and image overlays (GroundOverlay) are skipped, and the viewer says how many it skipped. Network links, which point to data online, are not fetched.

Can I convert KML to GeoJSON or CSV?

Yes. After you open a file, Download GeoJSON gives you a GeoJSON FeatureCollection and Download CSV a table with one row per feature: name, description, folder, every other field, latitude and longitude for points, and the shape as WKT. Descriptions come out as plain text.

Does it work with Google My Maps and Google Earth files?

Yes. Export from Google My Maps (Export to KML/KMZ) or save from Google Earth (Save Place As), then open the file here. Folders and layers become a folder column.

Is there a size limit?

Yes, 50 MB per file. Very big files can still be slow, because everything runs on your computer. The list under the map shows the first 500 features, and the downloads include all of them.

Moving the places into Spatibase? Read how to import a KML or KMZ file.

Talk to us

Not sure it’s a fit? Let’s find out

Tell us about your use case and what you need, from data model to security and deployment. In 30 minutes we’ll look at it together and tell you honestly if we can help.

Or write to hello@spatibase.com.