Bug report #5547
[DB Manager] - Geometry type (MultiPolygon) does not match column type (Polygon)
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||15140|
It seems related at #5328
drag & drop shp file throws this error:
Feature write errors: Creation error for features from #0 to #128. Provider errors was: PostGIS error while adding features: ERROR: Geometry type (MultiPolygon) does not match column type (Polygon) Only 0 of 129 features written.
The error was: ERROR: Geometry type (Polygon) does not match column type (MultiPolygon)
dataset to reproduce: http://urlin.it/2fe0e
#7 Updated by Giuseppe Sucameli almost 7 years ago
Looking at http://www.gdal.org/ogr/drv_shapefile.html:
Note that when reading a Shapefile of type SHPT_ARC, the corresponding layer will be reported as of type wkbLineString, but depending on the number of parts of each geometry, the actual type of the geometry for each feature can be either OGRLineString or OGRMultiLineString. The same applies for SHPT_POLYGON shapefiles, reported as layers of type wkbPolygon, but depending on the number of parts of each geometry, the actual type can be either OGRPolygon or OGRMultiPolygon.
It seems that he OGR shapefile driver always report singlepart geometry type though it contains multipart geometries.
I'm handling it within the QgsVectorLayerImport class.
#9 Updated by Giuseppe Sucameli almost 7 years ago
Fixed for QGis Friendly Courses http://www.qgis.org/en/sponsorship/qgis-friendly-courses.html