[gdal-dev] Question regarding OGRPolygon intersection

Silas Faltus Faltus at SpaceComputer.Com
Tue Jun 10 08:43:59 PDT 2014


Hi,

I was hoping to use GDAL for testing when two convex polygons intersect. I was able to do this with something similar to:

polyOne->Intersects(polyTwo);

Both polyOne and polyTwo are OGRPolygon and are defined in geographic coordinates, i.e. latitude and longitude (decimal degrees). I've also set the spatial reference of the polygons to 'SetWellKnownGeogCS("WGS84")'. Also, I've built GDAL with GEOS.

My question is this, what coordinate system is the intersection calculated in?   Looking through the code, it appears that GDAL uses GEOS for the intersection test, and GEOS seems to rely on JTS for the intersection test. However, JTS describes itself as providing '... algorithms for processing linear geometry on the 2-dimensional cartesion plane'.

So, as an example, if my polygons each contain three vertices, are they treated as spherical triangles in a geographic coordinate system (with curved edges) when the intersection test is performed? Or, are then treated as flat triangles with straight edges in some Cartesian / 2D coordinate system.

I appreciate any help answering this question,

Silas


More information about the gdal-dev mailing list