[QGIS-Developer] QgsVectorFileWriter for GeoJSON
matteo
matteo.ghetta at gmail.com
Wed May 22 09:02:03 PDT 2019
Hi all,
I cannot export a layer as GeoJSON using a very simple syntax:
error = QgsVectorFileWriter.writeAsVectorFormat(layer=vl,
fileName="/home/matteo/Desktop/my_json.geojson",
driverName="GeoJSON")
I always get an error like:
TypeError: QgsVectorFileWriter.writeAsVectorFormat(): arguments did not
match any overloaded call:
overload 1: 'driverName' is not a valid keyword argument
overload 2: 'driverName' is not a valid keyword argument
overload 3: 'driverName' is not a valid keyword argument
while with:
QgsVectorFileWriter.driverForExtension('.geojson') the output is:
'GeoJSON'
and from the documentation driverName seems to be a keyword argument:
https://qgis.org/pyqgis/master/core/QgsVectorFileWriter.html#qgis.core.QgsVectorFileWriter.writeAsVectorFormat
with "ESRI Shapefile" it works correctly.
Am I missing something?
Cheers and thanks for all the hints
Matteo
More information about the QGIS-Developer
mailing list