Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
1  
No only KML, you need to unzip the KMZ first to retrieve the KML. –  Mapperz Aug 23 '12 at 16:02
    
7 Zip provides a neat dialog for right click 'open archive' and then dragging the temp.kml into a folder –  Willy Aug 26 '12 at 11:11

8 Answers 8

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'.

share|improve this answer
    
how about opening the KMZ first...? –  mapBaker May 1 at 20:50

You can add kml layers as any other kind of vector layer, using the "add vector" dialog.

share|improve this answer
1  
KMZ's... not KML... –  mapBaker May 1 at 20:49

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.

share|improve this answer
1  
for decompressing KMZ files just change filenameextension from KMZ to ZIP and decompress with your favorite tool (winrar, 7zip, winzip ...) –  Kurt Sep 7 '12 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 Sep 8 '12 at 10:55

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)
share|improve this answer
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 Aug 23 '12 at 17:24
    
your procedure does not work for me with qgis 1.8 under win7. does this work only under max os?? –  Kurt Aug 23 '12 at 19:43
    
Tried it with Qgis Master b6760ce GDAL 1.9.1 on Windows XP, but no success here. –  Andre Joost Aug 24 '12 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 Aug 24 '12 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 Aug 24 '12 at 15:49

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

share|improve this answer
    
Folks, please leave a short comment for negative votes! Thanks –  Nikos Alexandris Apr 29 '13 at 13:43

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...

share|improve this answer

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.

share|improve this answer
4  
KMZs can be unzipped just as well without Google Earth. –  underdark Aug 24 '12 at 19:21

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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