6

EDIT - please link any similar questions as this needs testing on QGIS 3

Similar questions have been asked but without I think non "script" solutions

Is there a easier to use for non technical users for QGIS plugin/program to bulk export files? Say shp files to .kml files?

I believe a program: Expert GPS Pro that would do this, but this $299.95 at the time of writing. (http://www.expertgps.com/)

Similar Questions

Bulk SHP/KML Processing Tools

Bulk uploading shapefiles to PostGIS?

Exporting several files at same time in QGIS

https://gis.stackexchange.com/questions/137326/how-to-batch-layer-save-as-process-in-qgis?lq=1>

https://gis.stackexchange.com/questions/176490/convert-shp-to-mif-mid>

How to bulk import gpx files to QGIS and merge into a single shapefile?

Related Questions

CartoDB QGIS plugin: export/import projection shift?

EDIT

Cannot get plugin to work based on answer

Get error: 'NoneType' object has no attribute 'CreateDataSource' See log for more details

Tried kml to shp and shp to kml Autofill settings, used Do not autofill for each test. Perhaps this plugin is better in newer QGIS versions

In QGIS 2.2:

  • Output layer doesn't remember where you saving the files too
  • You have to fill the output layer in multiple times. The path (location to save files isn't remembered)
  • This bulk convert probably takes longer to setup than manually saving each file for a small number

How could you replicate Save Vector Layer Export settings, such as DataSource Options, Layer Options, Custom Options ect... via Creation Options Settings, so that the conversion is the "same"?

If you export kml files, I think you sometimes need to remove the altitude component via: Datasource Options, AltitudeMode: ClampToGround, so is this or other "settings" still possible via Creation Options?

I ask as I would assume you would still need to manually export files, if the settings are not "transferable" to the Convert Format.

Save vector layer as... window

Convert format window

2
  • www.geofileconverter.com this website above helps easily convert geographic file formats for example shp, csv, wkt, gml, kml... it is based on the OGR libraries. Commented Oct 15, 2018 at 22:41
  • @ElasriAbdessadek Thanks, just wanted this inside QGIS, but this question is out of date. I've just got back access to stackexchange
    – maskin
    Commented Oct 17, 2021 at 15:26

3 Answers 3

6

Yes, there is. its called "Convert format". Go to processing toolbox and run it from there by right click then run as batch processing.

enter image description here

UPDATE :

put as follow in creation option column:

-dsco AltitudeMode=absolute -dsco NameField=Name -dsco DescriptionField=Description

For example, in my case will be

-dsco AltitudeMode=clampToGround -dsco NameField=NAME_1 -dsco DescriptionField=Description

TEST RESULT enter image description here

Be Careful, when insert the creation option attribute (No space at the end allowed, seems it affecting the result):

Wrong → enter image description here Right → enter image description here

This extra description value can be modified as you need like AltitudeMode can be clampToGround or relativeToGround like the one that you see within "Save as" method.

UPDATE 2 - Alternative

-dsco altitudeModeEnum=clampToGround -dsco NameField=Name -dsco DescriptionField=description

Alternative option has been tested.

Source : GDAL.org and KML Guide for Google Developer

8
  • Thanks! :-) Could you explain the creation options? I would like to keep Datasource options, altitudeMode - clamptoGround Will add more information to question.
    – maskin
    Commented Jul 5, 2016 at 10:21
  • 1
    you can see updated answer. May it help?? Commented Jul 5, 2016 at 13:33
  • Thanks, that helps. Do you know if this gives the same result, has this been tested at all?
    – maskin
    Commented Jul 6, 2016 at 12:35
  • I am not sure how you might confirm these settings work, but I hope this comment doesn't come across rude, I am not sure how you would tell? Other than a kml has exported.
    – maskin
    Commented Jul 6, 2016 at 12:36
  • it's ok.. yes, it was updated and tested. Commented Jul 6, 2016 at 12:57
2

The answer provided by @UjeIndo seems to be the correct one although I am also unsure how to exactly use the Creation Options. But if you have loaded your shapefiles into QGIS, you could loop through each one and save it as a .kml file specifying the datasourceOptions by using the following in the Python Console:

result_path = "path/to/directory/"
for layer in QgsMapLayerRegistry.instance().mapLayers().values():
    QgsVectorFileWriter.writeAsVectorFormat(layer, result_path + layer.name(), "utf-8", None, "KML", datasourceOptions='your_text')
6
  • Thank you :-) but I am looking for non "script" options as this is more practical to explain to other users of QGIS I know. Unless you know of a dummies/step by step guide to running this in Python Console that I could share? :-) but I don't wish to ask too much of your time.
    – maskin
    Commented Jul 5, 2016 at 12:15
  • 2
    @maskin - Most welcome, there are other plugins available which convert shapefiles to kml such as Batch Save Layers and Bulk vector export but I don't think either of these support adding in custom options. But to run the above code, you can copy/paste it to a text editor, change the result_path and datasourceOptions, press Ctrl + Alt + P in QGIS to load up the python console, then paste the code and hit Enter twice ;)
    – Joseph
    Commented Jul 5, 2016 at 12:21
  • Thanks, I would like to expand your answer with your comment if that is possible? To highlight that the plugins are experimental so users can better find them.
    – maskin
    Commented Jul 5, 2016 at 12:39
  • 1
    i have updated my answer by adding description attribute to creation option. is it that you are looking for? Commented Jul 5, 2016 at 13:38
  • 1
    @Joseph No worries. :-) I tend to write longer answers adding in extra detail...
    – maskin
    Commented Jul 6, 2016 at 12:40
1

I think the best option might be the installation of the HCMGIS plugin, which has a built-in batch converter.

The plugin appears in the main top bar after installation. You can select:

HCMGIS -> Batch Converter -> Vector format converter

and next select the file extensions to convert: Shp, GeoJSON, CSV, Kml, Gpkg and Gml

enter image description here

2
  • This is great but it can only read KML, not write it. So annoying Commented Oct 7, 2022 at 17:20
  • Yeah, the plugin like others is at some point restricted. Thanks for raising your issue, I will try to find something other then.
    – Geographos
    Commented Oct 11, 2022 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.