Re: [gdal-dev] Convert KML to Shapefile PyQGIS
Dear Even Rouault, I got it done. Thank you very much for your reply. I appreciated your time Julierme On Tue, Mar 19, 2019 at 1:09 PM Even Rouault wrote: > 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 > ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Convert KML to Shapefile PyQGIS
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 ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
[gdal-dev] Convert KML to Shapefile PyQGIS
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/.shp", "utf-8", None, "ESRI Shapefile") Any help on that will be very appreciated. Kind regards Julierme ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev