[gdal-dev] Strange (expected?) behaviour exporting multipart geometry to ESRI Shapefile format

Andrea Giudiceandrea andreaerdna at libero.it
Wed Feb 16 04:24:21 PST 2022


Il 16/02/2022 12:24, Even Rouault ha scritto:
> your [2] link contains the shapefile, not the GeoPackage file.

Hi Even,
yes, you are right. The correct URL for the GeoPackage layer is 
https://drive.google.com/file/d/1DMMbFQ922d_ccS00JIt0KaojGk6jMorb

> Or you can use the SHAPE_REWIND_ON_WRITE configuration option 
> mentioned at 
> https://gdal.org/drivers/vector/shapefile.html#advanced-topics :
>
> ogr2ogr out3.shp Issue47288_Polygons.gpkg --config 
> SHAPE_REWIND_ON_WRITE OFF
>
> This will keep the original geometry mostly untouched, possibly 
> creating a non-conformant shapefile. And on the reading side, the OGR 
> shapefile reader might also have issues reconstructing a 
> single-feature geometry. On that particular case, it seems to produce 
> the "expected" result

Yes, exporting to Shapefile with this option, the visualization issue in 
QGIS doesn't occur in this case and the parts maintain their 
winding/orientation.

Thanks for the insight about the issue and on how the driver works under 
the hood and deal with the (not always clear) specification.

> My inclination would be to consider that in the case where we have a 
> multipolygon with non -coplanar parts we should probably be avoiding 
> considering the ones that are non-coplanar are inner/outer rings of 
> others.
>
> I've ticketed that in https://github.com/OSGeo/gdal/issues/5315

Thank you again.

Best regards.

Andrea


More information about the gdal-dev mailing list