[gdal-dev] OGR Polygon Intersection

Kai Mühlbauer kai.muehlbauer at uni-bonn.de
Sun Feb 28 02:26:11 PST 2021


Hi,

thanks Darafei, I've found the news on OverlayNG. Also thanks to Daniel 
Baston, who wrote me off list. Your help is very much appreciated.

So "normalize" would bring these polygons to their canonical form, which 
is coordinates in lexicographic order, right? I'll just add this to my 
testsuite.

@Even Rouault, I'd try adding "normalize" to GDAL OGR and python 
bindings, but my C/C++/SWIG knowledge might not be sufficient. If I'd 
try anyway, what should I read to prepare?

Cheers,
Kai


Am 27.02.21 um 19:11 schrieb Darafei "Komяpa" Praliaskouski:
> Please use GEOSNormalize / ST_Normalize or other equivalents before 
> comparing geometries between library versions. The starting point in the 
> ring can change because of different optimizations, and GEOS 3.9 was a 
> complete rewrite of the geometry overlay subsystem.
> 
> On Sat, Feb 27, 2021 at 9:02 PM Kai Mühlbauer 
> <kai.muehlbauer at uni-bonn.de <mailto:kai.muehlbauer at uni-bonn.de>> wrote:
> 
>     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
> 
>     _______________________________________________
>     gdal-dev mailing list
>     gdal-dev at lists.osgeo.org <mailto:gdal-dev at lists.osgeo.org>
>     https://lists.osgeo.org/mailman/listinfo/gdal-dev
>     <https://lists.osgeo.org/mailman/listinfo/gdal-dev>
> 
> 
> 
> -- 
> Darafei "Komяpa" Praliaskouski
> OSM BY Team - http://openstreetmap.by/ <http://openstreetmap.by/>



More information about the gdal-dev mailing list