36

I know I can add KML files once I have unzipped the KMZ files, but is there a way to open KMZ files directly?

When I try to open a kmz file on QGIS 1.8.0 on Windows XP, through the all files filter, it does not accept it as a valid format.

Am I doing something wrong?

Does this all depend on OGR support?

3
  • 3
    No only KML, you need to unzip the KMZ first to retrieve the KML.
    – Mapperz
    Commented Aug 23, 2012 at 16:02
  • 1
    7 Zip provides a neat dialog for right click 'open archive' and then dragging the temp.kml into a folder
    – Willy
    Commented Aug 26, 2012 at 11:11
  • 1
    On Windows in QGIS you can know open KMZ read only directly from the add layer (vector) dialog
    – BillW
    Commented May 10, 2017 at 6:43

9 Answers 9

18

On a Mac, where QGIS uses the Kyngchaos.com GDAL 1.9 Complete framework, or on any platform where QGIS has been compiled against a GDAL build with support for the Google LIBKML driver, you can open .kmz files directly using the open dialog and selecting the All Files (*) option, or simply drag/drop onto QGIS. (Otherwise, you will need to decompress the .kmz to .kml files as noted by @Kurt)

enter image description here

If the .kmz has multiple layers, you will be presented with a layer selection dialog (single layer .kmz files are immediately loaded):

enter image description here

You can select multiple layers in that dialog to import. The Example Overlay of Multiple Datasets .kmz file I tested (from here) allowed multiple layer import of point, line and polygon layer types.


EDIT: You can check for ogr LIBKML driver support in your version of QGIS by running the following commands in QGIS's Python Console:

import osgeo.ogr
print 'Has LIBKML ogr driver: ' + str(osgeo.ogr.GetDriverByName('LIBKML') is not None)
9
  • 2
    I believe this support comes from gdal's ability to read ZIP archives, which was recently added to QGIS. However, I couldn't find specifics on .kmz files (needs documented somewhere).
    – dakcarto
    Commented Aug 23, 2012 at 17:24
  • your procedure does not work for me with qgis 1.8 under win7. does this work only under max os??
    – Kurt
    Commented Aug 23, 2012 at 19:43
  • Tried it with Qgis Master b6760ce GDAL 1.9.1 on Windows XP, but no success here.
    – AndreJ
    Commented Aug 24, 2012 at 5:54
  • 2
    Assuming reporting Windows users are using the OSGeo4W installer, it appears the gdal/ogr library that ships with it does not include the LIBKML driver (which offers reading of .kmz files). There is already a request for including the driver in OSGeo4W. The GDAL 1.9 Complete framework installer for Mac by Kyngchaos.com includes the LIBKML driver. (In other words, this is not an issue with QGIS, per se.)
    – dakcarto
    Commented Aug 24, 2012 at 15:42
  • 2
    BTW: OSGeo4W users can check their gdal/ogr available formats by opening the MSYS console and typing either gdalinfo --formats or ogrinfo --formats. On Mac, using Terminal to run the same command for ogr, it reports "LIBKML" (read/write), whereas using my Windows 7 virtual machine's MSYS console, it reports no driver support. The "KML" (read/write) format, a different driver, is obviously supported on both platforms.
    – dakcarto
    Commented Aug 24, 2012 at 15:49
14

as far as I know, you are right: vectors in qgis are read and written by ogr. qgis 1.8 uses the lastest gdal/ogr, which is 1.91. you can read zipped shape-files, but *.kmz, which actually are a zip-archive containing *.kml-file(s) need to be unzipped manually before importing

6

Here is a guide to create and import KML files into Quantum. It does not work for KMZ files so these would need to first be decompressed to be used in this manner.

4
  • 2
    for decompressing KMZ files just change filenameextension from KMZ to ZIP and decompress with your favorite tool (winrar, 7zip, winzip ...)
    – Kurt
    Commented Sep 7, 2012 at 8:50
  • 1
    7 Zip has a right click option on kmz's to open them up, then drag and drop the kml right outta there
    – Willy
    Commented Sep 8, 2012 at 10:55
  • 1
    The link is broken
    – HoRn
    Commented Jun 19, 2020 at 17:59
  • @HoRn - thanks! I have updated the link.
    – sgrieve
    Commented Aug 10, 2020 at 10:05
3

You can add KML layers as any other kind of vector layer, using Layer .. Add Layer .. Add Vector Layer (or Ctrl-Shift-V).

1
2

Once you have opened the KML file in QGIS, you can also save it as a shapefile by right-clicking on the file in the layers pane and selecting 'save as'.

1
0

Rename datafile.kmz to datafile.zip then unzip the *.kml from inside.

1
  • Folks, please leave a short comment for negative votes! Thanks Commented Apr 29, 2013 at 13:43
0

I have QGIS 2.18 and you can add a *.kmz file.

-2

The solution is simple:

  1. in Google Earth, right-click on your loaded *.kmz file

  2. choose "save as..." and save the file as *kml

  3. Now, open the kml-file with QGIS

Tipp: if you want to save several *.kmz files and merge them in one sinlge *kml file, put your *.kmz files in Google Earth in one single folder in hte "locations" window of Google Earth. Than apply the procedure described above for the folder. One single *kml with all geogrpahic points in the folder will be produced, you can then open it with QGis.

If "on the fly projection" is activated, the points will show up on the right place in your OpenLayers Map in QGIS.

2
  • 5
    KMZs can be unzipped just as well without Google Earth.
    – underdark
    Commented Aug 24, 2012 at 19:21
  • Yes, just rename *.kmz *.zip and use the zip-tool of your choice ...
    – Kurt
    Commented Apr 24, 2018 at 18:01
-3

First Open In Google Earth And Save As Kml Format File and That you will open in QGIS 1.8.... open Vector Data File Change kml format...

Not the answer you're looking for? Browse other questions tagged or ask your own question.