[Qgis-user] [gdal-dev] Convert KML to Shapefile PyQGIS

Even Rouault even.rouault at spatialys.com
Tue Mar 19 09:09:16 PDT 2019


Julierme,

the issue here is that your KML file is seen as a multi-layer dataset, with
one feature per layer, so you can't use the logic you put below. You need to
merge all the layers in a single one.

You can do that with the ogrmerge.py script that comes with GDAL:
https://www.gdal.org/ogrmerge.html

$ ogrmerge.py -overwrite_ds -single -src_layer_field_name src_layer -o out.shp A_Cycle06.kml

With released versions of the script, this will be very slow. I've just pushed a fix to speed that up, so grab:
https://raw.githubusercontent.com/OSGeo/gdal/master/gdal/swig/python/scripts/ogrmerge.py

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the Qgis-user mailing list