[QGIS-Developer] QgsVectorFileWriter for GeoJSON

Nyall Dawson nyall.dawson at gmail.com
Thu May 23 15:47:48 PDT 2019


On Thu, 23 May 2019 at 17:17, matteo <matteo.ghetta at gmail.com> wrote:
>
> 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".

This works ok for me. What input geometry type and selected geometry
type are you using?

Nyall


More information about the QGIS-Developer mailing list