[QGIS-Developer] QgsVectorFileWriter and MultiPolygon

Luca Congedo semiautomatic.blogger at gmail.com
Thu Jun 29 12:25:06 PDT 2017

Hello everybody,

I am using the new QGIS 3 API to create a multipolygon shapefile using the
following code in python console:

import qgis.core as qgisCore
from PyQt5.QtCore import QVariant
crs = qgisCore.QgsCoordinateReferenceSystem("epsg:4326")
fields = qgisCore.QgsFields()
fN = "field"
fields.append(qgisCore.QgsField(fN, QVariant.Int))
outputVector = '/home/user/Desktop/vector.shp'
qgisCore.QgsVectorFileWriter(str(outputVector), "CP1250", fields,
qgisCore.QgsWkbTypes.MultiPolygon, crs, "ESRI Shapefile")
v = qgisCore.QgsVectorLayer(outputVector, "vector", "ogr")
# returns type 3

Apparently the created shapefile is not multipolygon. Am I missing
something? Or should I open a ticket?

Thank you,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170629/9b8c824f/attachment.html>

More information about the QGIS-Developer mailing list