[gdal-dev] OGR Polygon Intersection

Kai Mühlbauer kai.muehlbauer at uni-bonn.de
Sat Feb 27 09:02:23 PST 2021


Hi,

this might be a silly problem or no problem at all, but I currently 
can't wrap my head around it.

I'm using python bindings of GDAL OGR with GEOS support for layer 
intersection since several years now. Now suddenly my testsuit which 
checks intersection of two boxes breaks since the intersecting box 
starts now with a different starting point (all four points of the box 
fit with the earlier tests).

The change took place between versions GDAL 3.2.0 -> 3.2.1, GEOS 3.8.1 
-> 3.9.1 and PROJ 7.1.1 -> 7.2.0. I've tried to find anything what might 
have changed in the release notes of GDAL and GEOS, but couldn't.

So if anyone has a clue what's going on or what has changed and can 
point me to the relevant resources, I would greatly appreciate it.

Below you find the geometries I uses as JSON strings and the differing 
intersection.

src
'{ "type": "Polygon", "coordinates": [ [ [ 1.0, 1.0, 0.0 ], [ 1.0, 2.0, 
0.0 ], [ 2.0, 2.0, 0.0 ], [ 2.0, 1.0, 0.0 ], [ 1.0, 1.0, 0.0 ] ] ] }'

trg
'{ "type": "Polygon", "coordinates": [ [ [ 0.5, 0.5, 0.0 ], [ 0.5, 1.5, 
0.0 ], [ 1.5, 1.5, 0.0 ], [ 1.5, 0.5, 0.0 ], [ 0.5, 0.5, 0.0 ] ] ] }'

trg.Intersection(src) (GDAL 3.2.0, GEOS 3.8.1, PROJ 7.1.1)
'{ "type": "Polygon", "coordinates": [ [ [ 1.0, 1.5, 0.0 ], [ 1.5, 1.5, 
0.0 ], [ 1.5, 1.0, 0.0 ], [ 1.0, 1.0, 0.0 ], [ 1.0, 1.5, 0.0 ] ] ] }'

trg.Intersection(src) (GDAL 3.2.1, GEOS 3.9.1, PROJ 7.2.0)
'{ "type": "Polygon", "coordinates": [ [ [ 1.5, 1.5, 0.0 ], [ 1.5, 1.0, 
0.0 ], [ 1.0, 1.0, 0.0 ], [ 1.0, 1.5, 0.0 ], [ 1.5, 1.5, 0.0 ] ] ] }'

Thanks in advance!

Cheers,
Kai



More information about the gdal-dev mailing list