0

I have a problem with multipolygon layer stored in geopackage. In QGIS 3.22, $area function simply dint't work for some features in field calculator and leaved null values. So I decided to convert goepackage into shapefile and then got an error:

Export to vector file failed. Error: Feature write errors: Feature creation error (OGR error: Attempt to write non-polygon (MULTIPOINT) geometry to POLYGON type shapefile.) Feature creation error (OGR error: Attempt to write non-polygon (MULTILINESTRING) geometry to POLYGON type shapefile.) Feature creation error (OGR error: Attempt to write non-polygon (LINESTRING) geometry to POLYGON type shapefile.)

but the geopackage contains only one multipolygon layer:

enter image description here

What can be a reason?

1
  • 6
    Maybe there are invalid geometries (zero area polygons) and the exporting algorithm is trying to translate those to valid objects. Maybe you can gain an insight into the problem by looking at the result of geom_to_wkt($geometry) for those features
    – Javier JC
    Jan 14, 2023 at 20:00

1 Answer 1

1

I checked the geometry type following @Javier JC tip and there are some features saved as multinpoint and multilinestring in this layer. Most likely, these are features which left as single-vertex (multipoint) or double-vertices (multilinestring) after several operations on geometry - clipping intersecting and others. What is strange for me, as presented in the question, geometry type of layer is multi polygon, not GeometryCollection.

1
  • Depending on the software used to create the Geopackage file this is indeed possible. E.g. GDAL will issue a warning when you insert a geometry of a different type in a layer but it will allow it.
    – Pieter
    Jan 8 at 3:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.