[gdal-dev] Resulting geometry from OGRGeometry::difference somehow got simplified

mikeucfl mikeucfl at gmail.com
Tue Feb 6 11:58:25 PST 2018


Just to update with what I've figured out so far.

1. The issue surrounds an OGRMultiGeometry that has intersecting interior
rings.
2. The projection of the geometries are in EPSG 4326 (lat/long).
3. Internally in GEOS when the difference operator runs, there is a call to
check if the geometry is valid and it threw an exception saying it wasn't
and spit out a warning to the console that I didn't notice. Geos tried to
fix the geometry and in doing so the values got truncated or rounded to the
hundredths place. I'm guessing some algorithm is thinking the projection is
in meters and is what causes my data to get screwed up.

I have tried fixing the geometry prior to calling difference with a
OGRGeometry::Buffer(0.0) but that still doesn't fix the issue. What seemed
to resolve it was putting the geometry in a different projection that is in
meters (used web mercator), calling Buffer(0.0) and then calling Difference.

So if anyone sees a similar issue, it's something internally with GEOS but I
didn't have enough time to track it down. Re-projecting to something using
meters does help though.



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html


More information about the gdal-dev mailing list