[postgis-users] ST_Touches and line segment

Martin Davis mbdavis at refractions.net
Thu Mar 19 11:07:37 PDT 2009

It occurs to me that it might be simpler and faster to extract the 
boundary of polygonal geometries, and then use ST_relate with just the 
LL pattern (1**-***-*** ). 

Unfortunately there's no named predicate which means "intersects in a 
dimension equal to the dimension of the input".  Overlaps comes close, 
but requires that the two geometries have at least some points not in 
common.  This seems like it would be an ideal candidate for another 
named predicate - "intersectsFully", perhaps, or "overlapsOrCovers"

Kevin Neufeld wrote:
> Martin Landa wrote:
>> Hi,
>> AFAIU ST_Touches() returns True if two objects share at least one 
>> point (node).
> Actually, this is a partial truth.  ST_Touches(g1,g2) returns TRUE if 
> the only points in common between g1 and g2 lie in the union of the 
> boundaries of g1 and g2.  This means that it will also return TRUE for 
> objects that share a boundary line (AND whose interiors are not 
> overlapping).  See the examples in the new PostGIS docs:
> http://postgis.refractions.net/documentation/manual-svn/ST_Touches.html
>> Is there a way how to test whether objects share at least one line
>> segment (i.e. two points/nodes).
>> Thanks in advance, Martin
> If you have overlapping polygons then use ST_Relate with a custom 
> matrix.  IE. ST_Relate(g1, g2, '****1****') will return TRUE for all 
> geometry pairs where the intersection of the boundaries occur on a 
> line (1).
> Cheers,
> Kevin
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users

Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022

More information about the postgis-users mailing list