[QGIS-Developer] PyQGIS: Mixed Polygon/MultiPolygon shapefile

Nyall Dawson nyall.dawson at gmail.com
Wed May 30 04:52:16 PDT 2018

On 29 May 2018 at 23:39, Javier Sánchez Portero <javiersanp at gmail.com> wrote:
> Hello
> My name is Javier Sanchez and I'm the developer of a QGIS based standalone
> application to convert Spanish Cadastre data to OpenStreetMap format [1].
> I'm trying to port this app from QGIS 2 to 3 and I would like this to work
> also with the previous version.
> In QGIS 2.x, I was able to write a shapefile with a mixed set of polygons
> and multipolygons geometries. Now in QGIS 3.x I can't. Maybe this is a GDAL
> issue. Probably the last behaviour is the correct one. But is there any way
> in QGIS 3 to create a shapefile mixing polygons with multipolygons?

> The writer converts g1 from polygon to multipolygon and every geometry in
> the resulting shapefile have the same type while before I had a bunch of
> multipart and singlepart geometries.

In QGIS 3.x all features from a line/polygon shapefile are upgraded to
multi* features. This is done for consistency - it means that you can
safely check the WKB geometry type of the layer and be guaranteed that
all geometries from features in that layer will respect the multi or
single geometry type indicated by the layer's geometry type.


More information about the QGIS-Developer mailing list