[gdal-dev] Convert KML to Shapefile PyQGIS

Julierme Pinheiro juliermeopensourcedeveloper at gmail.com
Mon Mar 18 08:27:42 PDT 2019


Dear all,

I have a kml file which is like a zip kml file available in here (
https://www.eorc.jaxa.jp/ALOS-2/obs/map/world_asc/kml/A_Cycle06.kml) which
has several satellite polygon footprint for Alos/Palsar images. I am in
need to convert all these files from KML to SHAPEFILE, saving the SHP files
using the layer ID.

I am trying to use the piece of code bellow (PyQGIS), but I do not know how
to unzip this kml and save the shapefiles using the layer ID information

vlayer = QgsVectorLayer("D:/KML-Images/A_Cycle06.kml", "line", "ogr")

writer = QgsVectorFileWriter.writeAsVectorFormat(vlayer,
"D:/KML-Images/<layer ID>.shp", "utf-8", None, "ESRI Shapefile")

Any help on that will be very appreciated.

Kind regards


Julierme
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20190318/81d00c90/attachment.html>


More information about the gdal-dev mailing list