<div dir="ltr"><div><br></div><div>Hi Matteo,</div><div><br></div><div>Did you try this?<br></div><div><a href="https://qgis.org/pyqgis/master/core/QgsJsonExporter.html?highlight=json#module-QgsJsonExporter">https://qgis.org/pyqgis/master/core/QgsJsonExporter.html?highlight=json#module-QgsJsonExporter</a></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 22, 2019 at 6:02 PM matteo <<a href="mailto:matteo.ghetta@gmail.com">matteo.ghetta@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi all,<br>
<br>
I cannot export a layer as GeoJSON using a very simple syntax:<br>
<br>
error = QgsVectorFileWriter.writeAsVectorFormat(layer=vl,<br>
fileName="/home/matteo/Desktop/my_json.geojson",<br>
driverName="GeoJSON")<br>
<br>
I always get an error like:<br>
<br>
TypeError: QgsVectorFileWriter.writeAsVectorFormat(): arguments did not<br>
match any overloaded call:<br>
  overload 1: 'driverName' is not a valid keyword argument<br>
  overload 2: 'driverName' is not a valid keyword argument<br>
  overload 3: 'driverName' is not a valid keyword argument<br>
<br>
while with:<br>
<br>
QgsVectorFileWriter.driverForExtension('.geojson') the output is:<br>
<br>
'GeoJSON'<br>
<br>
and from the documentation driverName seems to be a keyword argument:<br>
<br>
<a href="https://qgis.org/pyqgis/master/core/QgsVectorFileWriter.html#qgis.core.QgsVectorFileWriter.writeAsVectorFormat" rel="noreferrer" target="_blank">https://qgis.org/pyqgis/master/core/QgsVectorFileWriter.html#qgis.core.QgsVectorFileWriter.writeAsVectorFormat</a><br>
<br>
with "ESRI Shapefile" it works correctly.<br>
<br>
Am I missing something?<br>
<br>
Cheers and thanks for all the hints<br>
<br>
Matteo<br>
_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a></blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature">Alessandro Pasotti<br>w3:   <a href="http://www.itopen.it" target="_blank">www.itopen.it</a></div>