Bug report #5547

[DB Manager] - Geometry type (MultiPolygon) does not match column type (Polygon)

Added by Salvatore Larosa almost 12 years ago. Updated over 11 years ago.

Status:Closed
Priority:High
Assignee:Giuseppe Sucameli
Category:DB Manager
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

Description

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.

Instead SPIT:

The error was:
ERROR:  Geometry type (Polygon) does not match column type (MultiPolygon)

dataset to reproduce: http://urlin.it/2fe0e

Associated revisions

Revision 08e844f6
Added by Giuseppe Sucameli over 11 years ago

create multipart layers whether the input is a singlepart shapefile (fix #5547)

History

#1 Updated by Salvatore Larosa almost 12 years ago

  • Target version deleted (Version 1.8.0)
  • Category changed from Python plugins to DB Manager

#2 Updated by Giovanni Manghi over 11 years ago

  • Assignee set to Giuseppe Sucameli

#3 Updated by Maximilian L. over 11 years ago

Same error on Windows 7.

#4 Updated by James Stott over 11 years ago

Same error here too on Windows 7 64 bit.

Loads into PostGIS fine using PostGIS Shapefile and DBF Loader 2 from within pgAdmin III.

#5 Updated by Giovanni Manghi over 11 years ago

  • Operating System deleted (Linux)
  • OS version deleted (Debian/wheezy)

master still affected

#6 Updated by Paolo Cavallini over 11 years ago

  • Target version set to Version 2.0.0

#7 Updated by Giuseppe Sucameli over 11 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.

#8 Updated by Giuseppe Sucameli over 11 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF