Giter VIP home page Giter VIP logo

qgis-kmltools-plugin's Introduction

QGIS KML Tools

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.

Processing Toolbox

Vector Tools

Import KML/KMZ Import KML/KMZ

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.

Import KML/KMZ

HTML description expansion Expand HTML description field

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:

  • Expand from a 2 column HTML table - If the KML has a description entry that contains an HTML table with two columns were the first column represents a table or field name and the second column its value, then this option will parse these fields and add them to a new attribute table field. This is an example of data that it expands.
    <table>
        <tr><td>City</td><td>Provo</td></tr>
        <tr><td>State</td><td>Utah</td></tr>
    </table>
  • Expand from "tag = value" pairs - If the KML has a description entry that contains "tag = value" entries separated by new paragraphs, line breaks, or entries in a single table column, then this option will parse these fields and add them to a new attribute table field. This is an example of data that it expands.
    <b>City<b/> = Provo<br/>
    <b>State<b/> = Utah<br/>
  • Expand from "tag: value" pairs - If the KML has a description entry that contains "tag: value" entries separated by new paragraphs, line breaks, or entries in a single table column, then this option will parse these fields and add them to a new attribute table field. This is an example of data that it expands.
    <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.

HTML Expander

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.

HTML Expander

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.

HTML Expander

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.

Export KMZ Export KMZ

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.

Export KMZ

The following describes some of the functionality.

  • Name/Label field - This is the name or label that will be displayed in Google Earth.
  • Use hidden points to display polygon labels - Labels on polygons are not normally displayed in Google Earth. By checking this box a hidden point will be created at the polygon's centroid so that a label will be displayed over the polygon.
  • Description fields - By default all fields are selected to be included in the KMZ. When the user clicks on a placemark in Google Earth, these fields will be displayed. If only one field is specified then it will be treated as a description field.
  • Export style for single, categorized, and graduated symbols - Select this if you want to export the QGIS style information to KML. Note that for lines and polygons, you can only use simple styles. If the style is not single, categorized, or graduated, then no style information will be exported.
  • Point layers: Use the following Google icon, but use QGIS icon color and size - Rather than display the QGIS icon shape, you can select one of the Google Earth icon shapes to be displayed for point features. The size and color of the icon will be determined by QGIS.
  • Specify whether to include altitude in the KMZ - If altitude is available in the QGIS geometry as a Z attribute or is available in the attribute table, then it can be included in the KMZ. Note that the altitude value must be in meters; otherwise, it will not be displayed correctly. The KML Altitude Mode also affects how altitude is interpreted.
  • Default altitude mode when not obtained from the attribute table - When altitude is not obtained from a field in the attribute table, then this value is used.
  • Altitude mode field - Specify a field in the attribute table to be used as the altitude mode.
  • Altitude field - Specify a field in the attribute table to be used as the altitude. This value must be in meters.
  • Altitude addend - Specify a quantity to be used as addend for altitude (from Altitude field or Z attribute). This value must be in meters.
  • Extend sides to ground - When checked, points, lines and polygon edges will be extruded to the ground.
  • Date/Time stamp field - This specifies a field in the attribute table that contains a date and time. This can be a QGIS QDateTime field, QDate field, QString field, int or double field. It attempts to smartly parse any string field. If the field is an int or double then at assumes the value is EPOCH time in seconds. In the advanced parameters, separate date and time fields can be used.
  • Date/Time span begin field - This selects a field for the date/time span begin field.
  • Date/Time span end field - This selects a field for the date/time span end field.
  • Image path/name field - This specifies the complete path to an image which will be included in to KMZ and will be displayed in the Google Earth placemark popup. As an example, if you have a directory of georeferenced images, you can run Import geotagged photos from the QGIS processing toolbox. This creates a Photo attribute which can be used for Export KMZ. Be careful that you only use small images for this purpose because all the images in the table will be copied into the KMZ and they will not be downsized.

Advanced Parameters

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.

    Advanced parameters
  • 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.

Raster Tools

Note that these tools are only available in QGIS 3.14.0 later.

Extract KML/KMZ Ground Overlays Extract KML/KMZ Ground Overlays

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>
Extract Ground Overlays

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.

Ground Overlay to GeoTIFF Image Ground Overlay to GeoTIFF Image

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.

Ground Overlay to GeoTIFF

qgis-kmltools-plugin's People

Contributors

hamiltoncj avatar talledodiego avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qgis-kmltools-plugin's Issues

Cannot set KMZ Vector NameField without also exporting a placemark?

Previous behavior of the KMZ Export tool that you could set the NameField value so that each polygon in the KMZ had a 'title' in the legend.
Now when setting the NameField, each polygon does have a 'title' in the legend but also has a placemark/label point in Google Earth- This can cause slow loading and instability for files with lots of polygons/labels
Can this be changed back or another option added to export/not export the placemark/label point?

KMZ export does not include point styles when selected features is toggled

Layer styles do not export when the selected features option is toggled, so that point symbols become the generic thumb tack symbol in Google Earth.

It does not work with the "export style for single, categorized, graduated symbols" option checked nor when a symbol style is selected from the Point Layers drop down. (I tested circles)

Other than that the plugin works great.

image

Can't expand the html description

Hi,

Right now i'm working on a polygon KMZ/KML that as the <BR> tag, and can't expand with the plugin, is the a simple way to add this tag?

The description field has this type of info.

Unknown Area Type<BR><BR><B>COD_UG</B> = 50242<BR><BR><B>NOME_UNID_</B> = QUEBRADAS<BR><BR><B>COD_TALHAO</B> = T01<BR><BR><B>COD_OCUP</B> = EG<BR><BR><B>PERIODO_RE</B> = 200208<BR><BR><B>CORTE1</B> = 2002<BR><BR><B>CORTE2</B> = 0<BR><BR><B>CORTE3</B> = 0<BR><BR><B>CORTE4</B> = 0<BR><BR><B>ROTACAO</B> = 2<BR><BR><B>DT_PLANT_I</B> = 198802<BR><BR><B>ANO_FOGO</B> = <BR><BR><B>DIVISAO</B> = 710<BR><BR><B>CONCELHOS</B> = ALFANDEGA DA FE<BR><BR><B>FREGUESIA</B> = ALFANDEGA DA FE<BR><BR><B>HECTARES</B> = 0

thx in advance

"Image path/name" field is not visible

When exporting to kmz the field "Image path/name" is missing.
Expected behaviour: field for chosing column with path of image is visible

QGIS-Version
3.10.12-A Coruña
QGIS-Codeversion
75c848ffb1
Kompiliert gegen Qt
5.11.2
Laufendes Qt
5.11.2
Kompiliert mit GDAL/OGR
3.1.4
Läuft mit GDAL/OGR
3.1.4
Kompiliert mit GEOS
3.8.1-CAPI-1.13.3
Läuft mit GEOS
3.8.1-CAPI-1.13.3
Kompiliert mit SQLite
3.29.0
Läuft mit SQLite
3.29.0
PostgreSQL-Client-Version
11.5
SpatiaLite-Version
4.3.0
QWT-Version
6.1.3
QScintilla2-Version
2.10.8
Kompiliert mit PROJ
6.3.2
Läuft mit PROJ
Rel. 6.3.2, May 1st, 2020
BS-Version
Windows 10 (10.0)
Aktive Python-Erweiterungen
kmltools;
line_profile;
lizmap;
nominatim_locator_filter;
oscars-georaster-qgis-plugin;
pluginbuilder3;
qgis_versioning;
QuickOSM;
timemanager;
track_profile_2_web;
trail_elevation_stats;
VoGisProfilTool;
weissflaechenkartierung;
processing

Export Alias and hide description field

Hello.
Two questions:
1 - Is there a way to export field alias insted of field name from shp to kmz?
2- And is it possible to hide the subtext and keep all table records as in the second image?

imagen

imagen

Thank you!

New option sugestion

Is it possible to consider developing a folder creation option in the KML output file based on some available field layer? It would be very helpful to separate the categorized origin data in the created file and more appearance configurations into Google Earth or other destination apps.

Error exporting polygon layer: no attribute 'strokeStyle'

Hello-
I don't know if this warrants a bug report, but I wanted to signal this error. I'm very new to QGIS and have next to zero Python skill.
I was running a batch conversion with one point file and one polygon file. The point file was successful, but the polygon was not. But I can't understand the error log well enough to troubleshoot. It seems to indicate some problem with the symbology of the polygon layer, which is shown in the attached screenshot.
grant_polygon_symbology_QGIS

Thanks for providing this tool, and thanks in advance for any help. Apologies if this post is not in order.
Export KMZ polygon error - no strokeStyle.txt

Adding side note: When I tried exporting the polygon layer with another plugin, Layer2KMZ, it failed with this apparently related error: "Error: 'QgsSimpleLineSymbolLayer' object has no attribute 'strokeWidth'"

Further note:
The conversion worked when I unchecked the "export style..." option.
Eric

Attribute Error ...

Hello,

I keep having issues, probably, since the last update, creating a kml file from my point layer file.

I hope you will understand my issue with the log file attached ...

Thanks for this pluggin I used a lot

Philippe

Error_Log.txt

Android Google Earth crashes

Hi.

I´m getting crashed on google earth on various android mobiles when opening a kmz exported by the plugin. It´s curious that some files always crash, and others I need to follow a given pattern of process to use. On the desktop google earth all runs ok.
When opening a kmz file, if I select directly a placemarker on the map (A), it crashes. If I choose the item on the project folders first (B), everything goes right.

image

Sorry, but I don´t have much experience to help with the problem, but I´m ready for everything you need.

I posted an example file in other to make some tests.

Regards.

Nelson Muylaert

teste KT.kmz.txt

Incorrect symbol encoding

Hi,
I would like to ask if this type of symbol can be correctly displayed at the marker title. As you can see, in the descriptions the symbol is correct.
image
Thanks again for your help and attention.
Nelson Muylaert

Add the ability to include images in the info box

This could be implemented in two ways.

  1. Each QGIS feature would have a field with a local file pointer to an image. These images would be copied into the KMZ and included as part of the popup window.
  2. The QGIS KMZ export would specify a folder of images to be included in the KMZ. The user would be responsible to provide html image links in an attribute from the attribute table to be part of the popup description.

I think I favor the second solution, but if anyone looks at these Issues, I welcome how you would like to see this work.

'NoneType' object has no attribute 'style'

I was trying the export a layer to kml but it failed. The log is as follows:

QGIS version: 3.24.1-Tisler
QGIS code revision: 5709b82461
Qt version: 5.15.2
Python version: 3.9.5
GDAL version: 3.4.2
GEOS version: 3.10.2-CAPI-1.16.0
PROJ version: Rel. 9.0.0, March 1st, 2022
PDAL version: 2.3.0 (git-version: 1c17a7)
Algorithm started at: 2022-04-06T12:18:35
Algorithm 'Export KMZ' starting…
Input parameters:
{ 'AltitudeAddend' : 0, 'AltitudeField' : '', 'AltitudeInterpretation' : 1, 'AltitudeMode' : 0, 'AltitudeModeField' : '', 'DateBeginField' : '', 'DateEndField' : '', 'DateStampField' : '', 'DateTimeBeginField' : '', 'DateTimeEndField' : '', 'DateTimeStampField' : '', 'DescriptionField' : ['fid','Area','Length','Name','To','Label'], 'ExportStyle' : True, 'InputLayer' : 'C:/Users/kobus.burger/OneDrive - Zutari/KBProjects/SKA MK+/Design/QGIS/MK+.gpkg|layername=MK+ Fibre cable', 'LineWidthFactor' : 2, 'NameField' : 'Name', 'OutputKmz' : 'C:/Users/kobus.burger/Downloads/tt.kmz', 'PhotoField' : '', 'TimeBeginField' : '', 'TimeEndField' : '', 'TimeStampField' : '', 'UseGoogleIcon' : None }

Traceback (most recent call last):
File "C:\Users/kobus.burger/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\kmltools\exportKmz.py", line 467, in processAlgorithm
self.exportStyle(kml_item, feature, export_style, geomtype)
File "C:\Users/kobus.burger/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\kmltools\exportKmz.py", line 538, in exportStyle
kml_item.style = self.cat_styles[catindex]
AttributeError: 'NoneType' object has no attribute 'style'

Execution failed after 0.13 seconds

Loading resulting layers
Algorithm 'Export KMZ' finished

Exporting style of points layer

Hi I'm trying to export the shapefile kishlaks_destroyed.shp to the kml file khait_1949_evans_building_destruction_points.kml . I've specified a categorised styling for the layer using the destructio attribute using the Layer Styling panel. (I had to upload these as text files)

On Export KML I chose:
Name/Label Field: destructio
Description Fields: destructio
Export style for..... : tick
Point Layers: circle placemark
Don't use altitude
Clamp to ground
Leave all the other options blank except Line Width Multiplication factor, which is 2.
Then I save the output to a path.

I get the output below and no kmz/kml file. Can you help? Thanks!

Algorithm 'Export KMZ' starting…
Input parameters:
{ 'AltitudeField' : None, 'AltitudeInterpretation' : 0, 'AltitudeMode' : 0, 'AltitudeModeField' : None, 'DateBeginField' : None, 'DateEndField' : None, 'DateStampField' : None, 'DateTimeBeginField' : None, 'DateTimeEndField' : None, 'DateTimeStampField' : None, 'DescriptionField' : ['destructio'], 'ExportStyle' : True, 'InputLayer' : '/Volumes/A_500gb_ben/phd/GIS/data/fault_traces/khait_mapping/evans_rasters/kishlaks_destroyed.shp', 'LineWidthFactor' : 2, 'NameField' : 'destructio', 'OutputKmz' : '/Volumes/A_500gb_ben/phd/GIS/data/fault_traces/khait_mapping/kmls_for_richard/khait_1949_building_destruction.kmz', 'TimeBeginField' : None, 'TimeEndField' : None, 'TimeStampField' : None, 'UseGoogleIcon' : 1 }

Traceback (most recent call last):
File "/Users/BenJohnson/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/kmltools/exportKmz.py", line 415, in processAlgorithm
self.exportStyle(kml_item, feature, export_style, render, geomtype)
File "/Users/BenJohnson/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/kmltools/exportKmz.py", line 473, in exportStyle
kml_item.style = self.cat_styles[catindex]
AttributeError: 'NoneType' object has no attribute 'style'

Execution failed after 0.06 seconds

Loading resulting layers
Algorithm 'Export KMZ' finished

kishlaks_destroyed.shp.txt

khait_1949_evans_building_destruction_points.kml.txt

Error range object message - graduated symbology

(Qgis 3.28.9 Plugin: 3.1.30 SO: Win 10)

Hi,
I´m getting a list of this error when exporting a graduated symbology layer:

image

I don´t know but only the selected legend features (A) appear with the circle marker (which I have chosen) on KMZ (B), the others come with the GE default pin image.

image

image

This is the symbology configuration:

image

And this is part of plugin configuration:

image

Do you have any idea of what is happening?

Missing QgsProcessingException import in importKml.py

When (accidentally) trying to import a .kml file that isn't actually KML data, the import errors because QgsProcessingException is undefined. Granted, this would still error either way, but it's not the intended error. It looks like it's simply missing a python import statement near the beginning of importKml.py.

Invalid extension: Should be kml or kmz
Failed to open file
Traceback (most recent call last):
File "/Users/Mark/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/kmltools/importKml.py", line 84, in processAlgorithm
raise QgsProcessingException(msg)
NameError: name 'QgsProcessingException' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/Mark/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/kmltools/importKml.py", line 88, in processAlgorithm
raise QgsProcessingException(msg)
NameError: name 'QgsProcessingException' is not defined

Execution failed after 0.03 seconds

Error code 1

getting error code 1 but do not see what that error code is.

AttributeError

I am trying to export a vector layer. The layer has rule-based symbology and calculated fields.

QGIS version: 3.18.3-Zürich
QGIS code revision: 735cc85be9
Qt version: 5.11.2
GDAL version: 3.1.4
GEOS version: 3.8.1-CAPI-1.13.3
PROJ version: Rel. 6.3.2, May 1st, 2020
Processing algorithm…
Algorithm 'Export KMZ' starting…
Input parameters:
{ 'AltitudeAddend' : 0, 'AltitudeField' : '', 'AltitudeInterpretation' : 1, 'AltitudeMode' : 0, 'AltitudeModeField' : '', 'DateBeginField' : '', 'DateEndField' : '', 'DateStampField' : '', 'DateTimeBeginField' : '', 'DateTimeEndField' : '', 'DateTimeStampField' : '', 'DescriptionField' : ['fid','name'], 'ExportStyle' : True, 'InputLayer' : 'C:/Users/kobus.burger/OneDrive - Zutari/KBProjects/SKA MK+/Design/QGIS/MK+.gpkg|layername=CoreMH', 'LineWidthFactor' : 2, 'NameField' : 'name', 'OutputKmz' : 'TEMPORARY_OUTPUT', 'PhotoField' : '', 'TimeBeginField' : '', 'TimeEndField' : '', 'TimeStampField' : '', 'UseGoogleIcon' : None }

No features processed
Execution completed in 0.18 seconds
Results:
{}

Loading resulting layers
Algorithm 'Export KMZ' finished
QGIS version: 3.18.3-Zürich
QGIS code revision: 735cc85be9
Qt version: 5.11.2
GDAL version: 3.1.4
GEOS version: 3.8.1-CAPI-1.13.3
PROJ version: Rel. 6.3.2, May 1st, 2020
Processing algorithm…
Algorithm 'Export KMZ' starting…
Input parameters:
{ 'AltitudeAddend' : 0, 'AltitudeField' : '', 'AltitudeInterpretation' : 1, 'AltitudeMode' : 0, 'AltitudeModeField' : '', 'DateBeginField' : '', 'DateEndField' : '', 'DateStampField' : '', 'DateTimeBeginField' : '', 'DateTimeEndField' : '', 'DateTimeStampField' : '', 'DescriptionField' : ['fid','length','name','to','label','area'], 'ExportStyle' : True, 'InputLayer' : 'C:/Users/kobus.burger/OneDrive - Zutari/KBProjects/SKA MK+/Design/QGIS/MK+.gpkg|layername=Williston outer repeater fibre cable', 'LineWidthFactor' : 2, 'NameField' : 'name', 'OutputKmz' : 'TEMPORARY_OUTPUT', 'PhotoField' : '', 'TimeBeginField' : '', 'TimeEndField' : '', 'TimeStampField' : '', 'UseGoogleIcon' : None }

Only single, categorized, and graduated symbol styles can be exported. Processing will continue without symbol style export.
Traceback (most recent call last):
File "C:/Users/kobus.burger/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\kmltools\exportKmz.py", line 461, in processAlgorithm
self.exportName(kml_item, feature[name_field])
File "C:/Users/kobus.burger/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\kmltools\exportKmz.py", line 751, in exportName
name = name.strip()
AttributeError: 'NoneType' object has no attribute 'strip'

Execution failed after 0.17 seconds

Loading resulting layers
Algorithm 'Export KMZ' finished

Line feed character export

Hi, it´s me again. I would like to know if it is possible to include the Line Feed (LF) character (/n) in kmz exported file.
The motivation is that some Qgis field has too much information, so I use the LF to try to organize a little bit the information in separate lines (see attached image).

image

But in kmz file, the information appears all lines together with no LF:

image

Is it possible to implement this suggestion?

And I think that is not possible to configure the exportation process to put the information also into the description tab of kmz POI, which at the present moment, has the HTML table string:

image

Thank you again for your attention and dedication to supporting and improving this wonderful plugin.

Nelson Freitas.

Geodatabase feature class export failure

I'm not sure if this is a bug or an unsupported feature, but I thought I'd let you know. I was unable to export this GDB feature class. Let me know if you want a data sample for testing, as I'm not sure whether it was an issue with this particular file. I was successful after I exported an intermediate shapefile & tried with that, instead.

'---------------------------------------------Failed attempt from Geodatabase----------------------------------------------------------
QGIS version: 3.22.1-Białowieża
QGIS code revision: 663dcf8fb9
Qt version: 5.15.2
Python version: 3.9.5
GDAL version: 3.4.0
GEOS version: 3.10.0-CAPI-1.16.0
PROJ version: Rel. 8.2.0, November 1st, 2021
PDAL version: 2.3.0 (git-version: 9f35b7)
Algorithm started at: 2022-01-25T09:41:56
Algorithm 'Export KMZ' starting…
Input parameters:
{ 'AltitudeAddend' : 0, 'AltitudeField' : '', 'AltitudeInterpretation' : 1, 'AltitudeMode' : 0, 'AltitudeModeField' : '', 'DateBeginField' : '', 'DateEndField' : '', 'DateStampField' : '', 'DateTimeBeginField' : '', 'DateTimeEndField' : '', 'DateTimeStampField' : '', 'DescriptionField' : ['OBJECTID','NWI_Code','NWI_Description','HGM_Description','Area_Acres','Reestablishment','Rehabilitation','HGM_Code','SHAPE_Length','SHAPE_Area'], 'ExportStyle' : True, 'InputLayer' : 'J:/2019/Project Folder/04. Environment/04. Wetlands/GIS/shapefiles/Geodatabase.gdb|layername=Wetlands_Shapefile', 'LineWidthFactor' : 2, 'NameField' : 'NWI_Code', 'OutputKmz' : 'J:/2019/Project Folder/04. Environment/04. Wetlands/GIS/shapefiles/Geodatabase.kmz', 'PhotoField' : '', 'TimeBeginField' : '', 'TimeEndField' : '', 'TimeStampField' : '', 'UseGoogleIcon' : None }

Traceback (most recent call last):
File "C:\Users/Me/AppData/Roaming/QGIS/QGIS3\profiles\User/python/plugins\kmltools\exportKmz.py", line 449, in processAlgorithm
kmlpart.outerboundaryis = [(pt.x(), pt.y(), altitude + altitude_addend) for pt in ext_ring]
TypeError: 'QgsCompoundCurve' object is not iterable

Execution failed after 3.69 seconds

Loading resulting layers
Algorithm 'Export KMZ' finished

'---------------------------------------------Failed attempt from Geodatabase with no altitude----------------------------------------------------------
QGIS version: 3.22.1-Białowieża
QGIS code revision: 663dcf8fb9
Qt version: 5.15.2
Python version: 3.9.5
GDAL version: 3.4.0
GEOS version: 3.10.0-CAPI-1.16.0
PROJ version: Rel. 8.2.0, November 1st, 2021
PDAL version: 2.3.0 (git-version: 9f35b7)
Algorithm started at: 2022-01-25T09:44:19
Algorithm 'Export KMZ' starting…
Input parameters:
{ 'AltitudeAddend' : 0, 'AltitudeField' : '', 'AltitudeInterpretation' : 0, 'AltitudeMode' : 0, 'AltitudeModeField' : '', 'DateBeginField' : '', 'DateEndField' : '', 'DateStampField' : '', 'DateTimeBeginField' : '', 'DateTimeEndField' : '', 'DateTimeStampField' : '', 'DescriptionField' : ['OBJECTID','NWI_Code','NWI_Description','HGM_Description','Area_Acres','Reestablishment','Rehabilitation','HGM_Code','SHAPE_Length','SHAPE_Area'], 'ExportStyle' : True, 'InputLayer' : 'J:/2019/Project Folder/04. Environment/04. Wetlands/GIS/shapefiles/Geodatabase.gdb|layername=Wetlands_Shapefile', 'LineWidthFactor' : 2, 'NameField' : 'NWI_Code', 'OutputKmz' : 'J:/2019/Project Folder/04. Environment/04. Wetlands/GIS/shapefiles/Geodatabase.kmz', 'PhotoField' : '', 'TimeBeginField' : '', 'TimeEndField' : '', 'TimeStampField' : '', 'UseGoogleIcon' : None }

Traceback (most recent call last):
File "C:\Users/Me/AppData/Roaming/QGIS/QGIS3\profiles\User/python/plugins\kmltools\exportKmz.py", line 449, in processAlgorithm
kmlpart.outerboundaryis = [(pt.x(), pt.y(), altitude + altitude_addend) for pt in ext_ring]
TypeError: 'QgsCompoundCurve' object is not iterable

Execution failed after 3.09 seconds

Loading resulting layers
Algorithm 'Export KMZ' finished

'---------------------------------------------Successful attempt from Shapefile----------------------------------------------------------
QGIS version: 3.22.1-Białowieża
QGIS code revision: 663dcf8fb9
Qt version: 5.15.2
Python version: 3.9.5
GDAL version: 3.4.0
GEOS version: 3.10.0-CAPI-1.16.0
PROJ version: Rel. 8.2.0, November 1st, 2021
PDAL version: 2.3.0 (git-version: 9f35b7)
Algorithm started at: 2022-01-25T10:00:39
Algorithm 'Export KMZ' starting…
Input parameters:
{ 'AltitudeAddend' : 0, 'AltitudeField' : '', 'AltitudeInterpretation' : 0, 'AltitudeMode' : 0, 'AltitudeModeField' : '', 'DateBeginField' : '', 'DateEndField' : '', 'DateStampField' : '', 'DateTimeBeginField' : '', 'DateTimeEndField' : '', 'DateTimeStampField' : '', 'DescriptionField' : ['OBJECTID','NWI_Code','NWI_Descri','HGM_Descri','Area_Acres','Reestablis','Rehabilita','HGM_Code','SHAPE_Leng','SHAPE_Area'], 'ExportStyle' : True, 'InputLayer' : 'J:/2019/Project Folder/04. Environment/04. Wetlands/GIS/shapefiles/Wetlands_Shapefile.shp', 'LineWidthFactor' : 2, 'NameField' : 'NWI_Code', 'OutputKmz' : 'J:/2019/Project Folder/04. Environment/04. Wetlands/GIS/shapefiles/Wetlands_Shapefile.kmz', 'PhotoField' : '', 'TimeBeginField' : '', 'TimeEndField' : '', 'TimeStampField' : '', 'UseGoogleIcon' : None }

Execution completed in 0.54 seconds
Results:
{}

Loading resulting layers
Algorithm 'Export KMZ' finished

png-files overwritten and in wrong place?

Thanks for a very nice plugin. I'm facing a problem with a kmz-file containing appr. 990 png-files in 35 sub-directories within the kmz-file. There are only 43 unique png filenames (the same filename is repeated in the different sub-folders).
I want to open the kmz (kml) file in QGIS and get all the png-files opened and shown at their correct location. Is that possible to do with this plugin? The kmz-file is zipped and attached.
Hardangervidda_v6.zip

[Feature Request] Implement "FolderPath" Feature

Arcgis has a neat little feature on exporting KMZs which takes the name of a field and if it starts with a slash it will create subfolders on each slash appearance. This is not that diferent from the current KML Tools' implementation however the ability to have many subfolder levels is often required.

Please see section "Folders and subfolders KML subfolders" here.

Thanks a lot!

Importing Kmz file with embedded images

I read the notice that you´re not so involved in the Qgis development. I got a little sad considering all the excellent support and attention you gave to this project.
Maybe it has time to ask how to can I import Kmz files with embedded images on it using the plugin. This file was generated by mapmaker app, which gives the following attribute structure:
image
You can access the kmz file by this link: https://drive.google.com/file/d/1CrvwU9yS-3FDC3Bfs91Rarb1sHb8FNSl/view?usp=sharing
I´ll thank you for your explanation about the possibilities and difficulties as you have all done.

KMLTools exportkmz in PyQGIS crashes the QGIS application

Running the code below works. But immediately after execution QGIS crashes and closes. I tried all options and flags, which don't seem have to have any effect on the script crashing. Would be cool if this could be fixed, for automation purposes.

processing.run("kmltools:exportkmz", {
        "InputLayer":kmzInputPath,
        "OutputKmz":kmzOutputPath,
        "SelectedFeaturesOnly":False,
        "NameField":"XXX",
        "HiddenPolygonPointLabel":False,
        "DescriptionField":[
            "XXX",
            "XXX"
        ],
        "ExportStyle":True,
        "UseGoogleIcon":None,
        "AltitudeInterpretation":1,
        "AltitudeMode":1,
        "AltitudeModeField":"",
        "AltitudeField":"Altitude",
        "AltitudeAddend":0,
        "ExtendSidesToGround":True,
        "DateTimeStampField":"",
        "DateTimeBeginField":"",
        "DateTimeEndField":"",
        "PhotoField":"",
        "LineWidthFactor":2,
        "DateStampField":"",
        "TimeStampField":"",
        "DateBeginField":"",
        "TimeBeginField":"",
        "DateEndField":"",
        "TimeEndField":""
})

Categoryzed Simbology not exported properly

In this latest version (3.1.18), using categoryzed simbology, results in only one of the classifications beeing represented in all vectors. Does anyone else have seen this behavior?

Uncaught ImportError: cannot import name 'processing'

Impossibile caricare il plugin 'kmltools' a causa di un errore chiamando il metodo classFactory()
Steps to reproduce

  1. First
  2. Second
  3. Third
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 335, in startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "/home/osgeolive/.local/share/QGIS/QGIS3/profiles/default/python/plugins/kmltools/__init__.py", line 9, in classFactory
    from .kmltools import KMLTools
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 685, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/home/osgeolive/.local/share/QGIS/QGIS3/profiles/default/python/plugins/kmltools/kmltools.py", line 28, in <module>
    from .provider import KmlToolsProvider
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 685, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/home/osgeolive/.local/share/QGIS/QGIS3/profiles/default/python/plugins/kmltools/provider.py", line 7, in <module>
    from .convertGroundOverlays import ConvertGroundOverlayAlgorithm
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 685, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/home/osgeolive/.local/share/QGIS/QGIS3/profiles/default/python/plugins/kmltools/convertGroundOverlays.py", line 17, in <module>
    from qgis import processing
ImportError: cannot import name 'processing'

kmltools 3.1.7, QGIS 3.4.10-Madeira on Linux 5.0.0-23-generic

AttributeError: 'QgsGeometryGeneratorSymbolLayer' object has no attribute 'strokeStyle'

When trying to export a polygon layer, the following error is raised:
AttributeError: 'QgsGeometryGeneratorSymbolLayer' object has no attribute 'strokeStyle'

The traceback points to:

kmltools/exportKmz.py, line 847, in initStyles
    stroke_style = symbol_layer.strokeStyle()

which sounds like this statement is using a deprecated method strokeStyle. It's unclear if there is a previous version of QGIS where this would work, but in any case, exporting polygons doesn't seem to work anymore.

I'm using these versions:

kmltools | 3.1.31
QGIS version | 3.32.2-Lima
Qt version | 5.15.2
Python version | 3.9.5
GDAL/OGR version | 3.3.2
PROJ version | 8.1.1
EPSG Registry database version | v10.028 (2021-07-07)
GEOS version | 3.9.1-CAPI-1.14.2
SQLite version | 3.35.2
OS version | macOS 13.5

A question

I have a question about KML Tools. How can contact you?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.