Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
QGIS 2 Cookbook

You're reading from   QGIS 2 Cookbook Become a QGIS power user and master QGIS data management, visualization, and spatial analysis techniques

Arrow left icon
Product type Paperback
Published in Apr 2016
Publisher
ISBN-13 9781783984961
Length 390 pages
Edition 1st Edition
Tools
Arrow right icon
Authors (3):
Arrow left icon
Anita Graser Anita Graser
Author Profile Icon Anita Graser
Anita Graser
Víctor Olaya Ferrero Víctor Olaya Ferrero
Author Profile Icon Víctor Olaya Ferrero
Víctor Olaya Ferrero
Alex Mandel Alex Mandel
Author Profile Icon Alex Mandel
Alex Mandel
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Data Input and Output FREE CHAPTER 2. Data Management 3. Common Data Preprocessing Steps 4. Data Exploration 5. Classic Vector Analysis 6. Network Analysis 7. Raster Analysis I 8. Raster Analysis II 9. QGIS and the Web 10. Cartography Tips 11. Extending QGIS 12. Up and Coming Index

Importing KML/KMZ files

KML and KMZ files are used and produced by Google Earth and are a popular format. This recipe shows you how to open them with QGIS.

How to do it…

  1. To open a KML layer, select Layer/Add vector layer.... In the dialog that opens, click on the Browse button to open the file selector dialog. Select the Keyhole Markup Language (KML) format and then select the file that you want to load. In the example dataset, you can find several KML files. Select the elcontour1m.kml file. Click on OK in the vector layer selector dialog, and the layer will be added to your project, as shown in the following screenshot:
    How to do it…

    Note

    KMZ files can also be opened in QGIS.

  2. Go to Layer | Add vector layer.... In the dialog that opens, click on the Browse button to open the file selector dialog. Select the All files option to view all the files and then select the elcontour1m.kmz file. There is not a KMZ file type defined in QGIS, but QGIS supports it because the underlying OGR library can read KMZ files as well.
  3. Click on OK on the open layer dialog to open the selected layer.

From the layers contained in the KMZ file, you must select one of them. In this case, only a layer is contained in the elcontour1m.kmz file, so it is loaded automatically. The layer will be added to your QGIS project.

How it works…

KMZ files are compressed files that contain a set of layers. When you select it, the OGR library will unzip the content of this file and then open the layers that it contains.

If just a single layer is contained, you will not see the layer selection dialog. QGIS will automatically open the only layer in the KMZ file.

There's more…

As KMZ is not recognized as a supported format, the KMZ file will not appear in the QGIS browser. However, the browser supports zipped files, and a KMZ file is actually a zipped file with KML files inside it. Unzip it in a folder and then you will be able to use the QGIS Browser to open the layers it contains.

You have been reading a chapter from
QGIS 2 Cookbook
Published in: Apr 2016
Publisher:
ISBN-13: 9781783984961
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image