[GIS] ST_RELATE – Intersect ignore shared boundary

de-9imoverlaypostgispostgresql

Using postgis I am trying to find polygons that intersect, ignoring polygons that only have a shared boundary (edge).

  1. ST_Relate(g1, g2, 'T********') is a standard intersection.
  2. ST_Relate(g1, g2, 'TF*F*****') standard intersection with boundary touching false

An image of what I am trying to achieve (from: http://daniel-azuma.com/articles/georails/part-6):

enter image description here

I am confident in the underlying geometries as they are created inside of postgis by taking the overlay similar to here.

Similar to: postgis st_relate polygon inside another and sharing a boundary though I want to ignore cases where the only topological connection is the boundary.

Best Answer

Actually the first relation that you list does exclude the Touch relation, and maybe exactly what you want: ST_Relate(g1, g2, 'T********').

The regular Intersects relation cannot be represented as a single D9IM. But the opposite of the Intersects - the Disjoint can be represented as 'FF*FF****'.

So if you want to exclude the Touch, use 'T********'. But maybe you want the Overlaps relation? That is, maybe you want to exclude the Contains and Within as well, then use 'T*T***T**'. It does not allow one polygon to be contained inside of another.

Both 'T********' and 'T*T***T**' allow only the right of the two configurations on your illustration.

Related Question