- QGIS 2 Cookbook
- Alex Mandel Víctor Olaya Ferrero Anita Graser Alexander Bruy
- 367字
- 2021-07-16 11:12:36
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…
- 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: - 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. - 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.
- OpenCV實例精解
- Learning ArcGIS Pro 2
- HTML5 Mobile Development Cookbook
- 你必須知道的204個Visual C++開發問題
- Learning Python Design Patterns
- 碼上行動:用ChatGPT學會Python編程
- Python極簡講義:一本書入門數據分析與機器學習
- 好好學Java:從零基礎到項目實戰
- Image Processing with ImageJ
- Scala編程實戰
- ASP.NET Web API Security Essentials
- Learning D
- 數字媒體技術概論
- Visual Basic程序設計基礎
- Tableau Dashboard Cookbook