Hi Matteo,

Did you try this?
https://qgis.org/pyqgis/master/core/QgsJsonExporter.html?highlight=json#module-QgsJsonExporter


On Wed, May 22, 2019 at 6:02 PM matteo <[email protected]> wrote:

> 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
> _______________________________________________
> QGIS-Developer mailing list
> [email protected]
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer



-- 
Alessandro Pasotti
w3:   www.itopen.it
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to