[postgis-devel] Issue 148 in postgis: st_touches doesn't work as it should on st_touches(line, point)

nicklas.aven at jordogskog.no nicklas.aven at jordogskog.no
Wed Apr 8 10:36:27 PDT 2009


OK, 
 
everything is about the definitions of boundaries an interior.
 
from your definition Regina it is not logical that 
SELECT ST_Touches('LINESTRING(0 0, 1 1, 0 2)'::geometry, 'LINESTRING(1 1, 2 2, 3 3)'::geometry);
returns true. 

There is two multipoints as boundaries and they don't share any point.
 
But I see it from 
Kevins definition :
1. the intersection of (a) and (b) is not the empty set (which means they have to
interact somehow) AND
2. the intersection of the interior of (a) and the interior of (b)is the empty set

The problem I think, is to see is why a multipoint of endpoints is the boundarie of a line, and why a point have interior but no boundarie. I don't see the logic but I guess it is just definitions that have to be done.
 
In pactice it can give som strange behavior I think. The way I discovered this was that I wanted to check for touches in road-crosses. My dataset was quite big so I tested the end and startpoint against the lines instead of line to line, and then I thought I had some strange results.
 
SELECT ST_Touches('LINESTRING(0 0, 1 1, 0 2)'::geometry, 'LINESTRING(1 1, 2 2, 3 3)'::geometry);
returns true but
SELECT ST_Touches('LINESTRING(0 0, 1 1, 0 2)'::geometry, st_startpoint('LINESTRING(1 1, 2 2, 3 3)'::geometry));
returns false.
 
>From the definitions I see it but from another point of view it is a little strange that the second part of Kevins statement falls when we take away two points of the line and it gets a point. 
Why the rule that the "intersection of the interior of (a) and the interior of (b) is the empty set" turns to false when geometry b gets smaller. 
In other words that the intersection appears when we remove two points....
 
/Nicklas
 

2009-04-08 codesite-noreply at google.com wrote:

Updates:
> Status: Invalid
>
>Comment #1 on issue 148 by robe.... at cityofboston.gov: st_touches doesn't 
>work as it should on st_touches(line,point)
>http://code.google.com/p/postgis/issues/detail?id=148
>
>Nicklas -- I think this is by design. Touches is a weird thing -- but in 
>the docs it
>says
>
>2 geometries only touch if their boundaries share points together. The 
>boundary of a
>line string is a MULTIPOINT. If you do this
>
>SELECt ST_AsText(ST_Boundary('LINESTRING(0 0, 1 1, 0 2)'::geometry))
>
>you get this -- MULTIPOINT(0 0,0 2) -- so the only geometries that qualify 
>as
>touching this linestring are 0 0 and 0 2 as you have observed.
>
>Kevin please correct me if I am wrong because this is a very touchy subject 
>(well in
>terms of nuances anyway)
>
>--
>You received this message because you are listed in the owner
>or CC fields of this issue, or because you starred this issue.
>You may adjust your issue notification preferences at:
>http://code.google.com/hosting/settings
>_______________________________________________
>postgis-devel mailing list
>postgis-devel at postgis.refractions.net
>http://postgis.refractions.net/mailman/listinfo/postgis-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20090408/3dc55f3c/attachment.html>


More information about the postgis-devel mailing list