[gdal-dev] Layer intersection: two polygons with a common point

Ari Jolma ari.jolma at gmail.com
Wed Apr 27 23:50:46 PDT 2016


Jukka pointed out this

http://gis.stackexchange.com/questions/191336/gdal-ogr-ogr-layer-intersection-producing-points-from-linestrings

to me.

It is true that intersecting two layers, where one contains

'POLYGON (( 140 360, 140 480, 220 480, 220 360, 140 360 ))'

and the other

'POLYGON (( 220 260, 220 360, 300 360, 300 260, 220 260 ))'

produces an empty layer. The reason is a check

(z_geom->IsEmpty() ||
   (x_geom->getDimension() == 2 &&
    y_geom->getDimension() == 2 &&
    z_geom->getDimension() < 2))

(x and y are the polygons and z is the intersection, a point in this 
case), which leads to discarding the point.

I believe this check was introduced as a result of ticket 4772

https://trac.osgeo.org/gdal/ticket/4772

in changeset 25427, where it is stated that "when intersecting 2 
polygons, do not consider a point or linear intersection as a valid one".

I'm a bit ill right now so can't really think too hard on this but can 
we say why we don't consider a point as valid here?

Ari



More information about the gdal-dev mailing list