Bug report #16784
Creation of MultiPolygon shapefile with QgsVectorFileWriter
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Geometry | ||
Affected QGIS version: | master | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | duplicate |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 24683 |
Description
Hello,
I am trying to create a multipolygon shapefile using QgsVectorFileWriter with 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") v.wkbType()
The type returns 3, which is not multipolygon, and I can't add a multipolygon to the layer.
Am I missing something?
Thank you.
Related issues
Associated revisions
History
#1 Updated by Nyall Dawson over 7 years ago
- Resolution set to duplicate
- Status changed from Open to Closed
Duplicate of #16758
#2 Updated by Jürgen Fischer over 7 years ago
- Related to Bug report #16758: regression: adding a multi-part feature to a shapefile dataset fails added