[QGIS-Developer] Pyqgis layer export in GeoJson with option RFC7946=True
Thomas Gratier
osgeo.mailinglist at gmail.com
Fri Nov 27 10:13:20 PST 2020
Hi,
You should run the following considering you selected a vector layer
from qgis.core import QgsVectorFileWriter
layer = iface.activeLayer()
QgsVectorFileWriter.writeAsVectorFormat(layer, '/tmp/out.geojson', 'utf-8',
layer.crs(), 'GeoJSON', layerOptions=['RFC7946=True'])
Regards
Thomas Gratier
Le mer. 25 nov. 2020 à 18:47, PALMIER Patrick (Responsable de groupe) -
CEREMA/DTerNP/DATHa/MT <Patrick.Palmier at cerema.fr> a écrit :
> Hello,
>
> I'm using Qgis 3.14.16 with WIndows 10
>
> I'm trying in a python script to export a layer in geojSon with the
> option RFC7946=True
> It works well with the gui, but I don't know how to write it in a python
> script
> Is there someone who could send me a sample of code which do this
>
>
> Thanks
>
>
> Patrick
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20201127/da160ba7/attachment.html>
More information about the QGIS-Developer
mailing list