The native QGIS importer creates separate layers for each folder within a KML/KMZ. If there are hundreds or thousands of layers, the import can be very slow, crash QGIS, or create an undesirable number of layers. This plugin only creates one point layer, one line layer, and one polygon layer. This makes the KML/KMZ import very quick. It adds the nested folder structure to a field in the QGIS layer which can then be used for sorting and filtering based on the folder structure in the KML. A KMZ can be exported with simple, categorized, and graduated QGIS styling for points, lines and polygons. Limited support has been added to convert embedded ground overlay images into GeoTIFF images.
KML Tools can be found in the QGIS menu under Vector->KML Tools and Raster->KML tools, on the tool bar, or in the Processing Toolbox under KML Tools. It has three vector tools and two raster tools. This shows the tools in the Processing Toolbox.
This functions as the name implies. It's interface is simple. Click on the ... button on the right of Import KML/KMZ file to select your file. Note that the file name extension must be .kml, .txt, or *.kmz. Choose whether you want to include points, lines or polygons from the KML as QGIS output layers. If the KML file does not contain one of these geometry types, then the associated layer will not be created anyway.
This attempts to expand HTML tag/value pairs into separate fields. Before this can be run, the KML needs to be imported into QGIS with Import KML/KMZ. Next select from How to expand the description field option one of the following:
<table>
<tr><td>City</td><td>Provo</td></tr>
<tr><td>State</td><td>Utah</td></tr>
</table>
<b>City<b/> = Provo<br/>
<b>State<b/> = Utah<br/>
<b>City:<b/> Provo<br/>
<b>State:<b/> Utah<br/>
This can either be run from the menu, tool bar, or Processing Toolbox; however, running it from the menu or tool bar provides user interaction during the conversion to select which fields they want to expand. During expansion some of the expansion names may already exist in the table. If that is the case then an '_' followed by a number is appended to the end.
Select the input layer and the field that has an HTML table of tag/value rows. Press OK and it will look through all records and find all possible tag values. If it finds tags, then it will pop up a menu for you to select which tags you want expanded into table entries like this.
The Processing Toolbox version of Expand HTML description table operates a little differently because processing routines cannot be interactive. In this case it will expand all possible tags that are found. Optionally, you can include a list of name tags you want expanded if you know them ahead of time. This is the Processing expansion dialog box.
Because there is no standard way of including additional information in the KML description entry, it is difficult to come up with a way to expand all cases. Right now this just works with two column HTML tables, tag=value, and tag: value pairs, but please let us know if there are other description formats that you would like us to tackle.
This provides the ability to export a QGIS point, line, or polygon layer as a Google Earth KMZ file. It can export single, categorized, and graduated QGIS symbology. For others it will default to not exporting the symbology. For points it captures the entire symbol, but for lines and polygons only simple line colors, line widths, simple line outlines and solid polygon fills can be exported due the limitations of the KML specification. It can export date and time in one or two fields as a time stamp, time begin and time end. It also handles altitude either from QGIS Z geometries or from an attribute field and eventually add a constant quantity.
The following describes some of the functionality.
Advanced Parameters
Line width multiplication factor - Line widths in Google Earth visually appear smaller than in QGIS so this provides a method to make them look similar. By default this is set to 2.
Select field to create categorized KML subfolders - You can select an attribute to create categorized folders in the output KML. This is an example of National Parks layer exporated as a KML and displayed in Google Earth. You can see the National Parks categorized by their type.
The rest of the advanced parameters allow the use of separate date and time fields to be combined into a single KML time stamp, time span begin, or time span end field.
KML Tools does not implement the entire KML specification. It focuses on point, line and polygon geometries within the KML. If for some reason you find that it is missing something, let us know and perhaps we can add it.
Note that these tools are only available in QGIS 3.14.0 later.
This algorithm looks through the KML/KMZ for KML GroundOverlay tags and if the associated image is embedded in the KMZ or is on the local file system it will convert it to a GeoTIFF according to the LatLonBox parameters. Note that this algorithm will not follow and extract http(s) linked images. The following shows the KML tags that are extracted. In this case etna.jpg is converted to etna.tif.
<Icon> <href>etna.jpg</href> </Icon> <LatLonBox> <north>37.91904192681665</north> <south>37.46543388598137</south> <east>15.35832653742206</east> <west>14.60128369746704</west> <rotation>-0.1556640799496235</rotation> </LatLonBox>
The parameters are the input KML or KMZ and the location of a folder to store the images in. You can also specify whether to automatically load the converted GeoTIFF images into QGIS or not. If any images are found that cannot be converted, they will be reported in the algorithm log. If rotation is involved in the conversion process, the output GeoTIFFs are compatible with QGIS, but may not be compatible with other programs. If needed, run these images through GDAL->Raster projections->Warp to make them compatible with other programs.
This algorithm manually allows the user to specify an image and enter the north, south, east, west and rotation parameters to convert the input image into a GeoTIFF image. If rotation is not zero, the output GeoTiff is compatible with QGIS, but may not be compatible with other programs. If needed, run the output of this algorithm through GDAL->Raster projections->Warp to make it compatible with other programs.