[gdal-dev] Polygon intersection failure

Even Rouault even.rouault at spatialys.com
Tue Jul 17 14:25:54 PDT 2018


On mardi 17 juillet 2018 14:33:42 CEST Jon Morris wrote:
> Hello all,
> 
> I'm having a problem with layer intersection and am not sure if I'm using
> the options correctly or if there is some functionality missing. I'm using
> GDAL 2.2.0 with Python 2.7.
> 
> I've got a layer of UK postcodes and a layer of UK buildings; when I run
> postcode_lyr.Intersection(building_lyr, out_lyr), I get RuntimeError:
> Attempt to write non-polygon (POINT) geometry to POLYGON type shapefile.
> With the option SKIP_FAILURES=YES, the intersection completes, but one
> postcode is left out. I get the same result when running the other way
> round - building_lyr.Intersection(postcode_lyr).
> 
> Is there a way of getting GDAL to only skip the bad geometry, but still add
> the remaining geometries for that feature? There should be three polygons
> in the result layer for that particular postcode. Or is there a way to find
> out which features have been skipped so I can go back and try and perform
> the intersection manually for just those features?

You could try the KEEP_LOWER_DIMENSION_GEOMETRIES=NO option for that to skip 
punctual intersections in polygon layers.
There is no debug traces currently on which features had failures. Something 
that could certainly be improved

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list