1

I want to save a KML point file with attributes and descriptions from a generic point vector layer, and I need to do this at the end of a processing chain inside QGIS graphical modeler. Ideally, I would have the option to choose the icons of the KML points.

From here, I've started to use the "Convert Format" algorithm from GDAL asuming that this would be the simplest option.

I've wrote the following script to do so (but I'm missing how to call the -dsco NameField=RegionName option to have the descriptions correctly labeled)

##Convert=name
##Layer=vector

layer = processing.getObject(Layer)
output_path = "C:/Users/jmgc/Desktop/testes_script/" + layer.name() 

processing.runalg("gdalogr:convertformat", Layer, 15, '', output_path)

Adding the -dsco NameField=RegionName gives me an error:

##Convert=name
##Layer=vector

layer = processing.getObject(Layer)
output_path = "C:/Users/jmgc/Desktop/testes_script/" + layer.name() 

processing.runalg("gdalogr:convertformat", Layer, 15, -dsco NameField=RegionName, output_path)

Any thoughts on how to solve this on my prescriptive or following another one would be helpful.

7
  • 1
    Try putting -dsco NameField=RegionName inside quotation marks. I.e. '-dsco NameField=RegionName' so that it is read as a string. – Joseph Mar 5 '18 at 12:44
  • Joseph, indeed it worked. I could swear i've tried that earlier... – zemigl Mar 5 '18 at 15:12
  • It would also be possible to edit the marker icon using this script? – zemigl Mar 5 '18 at 15:13
  • Don't worry about it, happens to most of us :). What do you mean by "marker icon"? – Joseph Mar 5 '18 at 15:21
  • The default marker icon when opening the points with Google Earth. I guess I wasn't very clear. Also noticed when using the -dsco option the file looses the attribute table data when clicking over the icon. Without this option, all the attributes appears when clicking the icon (Google Earth) – zemigl Mar 5 '18 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.