[QGIS-Developer] QgsVectorFileWriter for GeoJSON

matteo matteo.ghetta at gmail.com
Thu May 23 00:17:58 PDT 2019


Hi Nyall,

> It's a rubbish error message. Blame sip. It should be saying:
> 
> "arguments did not match any overloaded call:
> missing 1 required positional argument: 'fileEncoding'"

ahhhhh ok, get it now, thanks!
> 
> Because, as the dox show, fileEncoding is a required argument. And
> indeed, this works fine for me:
> 
>     error = QgsVectorFileWriter.writeAsVectorFormat(layer=iface.activeLayer(),fileEncoding='UTF-8',fileName='/home/nyall/Temporary/test.geojson',driverName='GeoJSON')

however is it possible that the exported geojson file does not have the
Z value even if the source file has it? It happens also by exporting the
layer with the UI and forcing the geometry type and checking the
"Include Z dimension".

Cheers

Matteo



More information about the QGIS-Developer mailing list