[geos-devel] how to know if two linestrings "really" cross each other

Martin Davis mtnclimb at telus.net
Wed May 30 13:26:52 PDT 2012


The DE-9IM model isn't designed to be able to distinguish between these 
two cases, so there's no way to compute this by using any of the named 
predicates, or even a custom relate matrix.

You could do this via some fairly straightforward custom code.  The 
algorithm is:
-  identify vertices in each linestring which are coincident
- build a simple "local topology" for the 4 incident line segments at 
each intersection
- examine the intersection to see if the segments alternate or are 
adjacent (you can do this by using the angles of the segments)

On 5/30/2012 3:40 AM, Jasmin FORMONT wrote:
>
> Hi everyone
>
> I can't find a way to tell if two linestrings "really" cross each other.
>
> For instance if I have this linestring :
>
> Line1 : LINESTRING(0 0, 1 1, 2 0)
>
> How can I differentiate the relation of line 1 with one of the following :
>
> Line2 : LINESTRING(0 2, 1 1, 2 2)    -> no "real" cross, just a 
> contact point
>
> Line3 : LINESTRING(0 2, 1 1, 1 0)    -> lines "really" cross each other
>
> I can't find a good combination of crosses, touches, etc... to 
> differentiate these cases.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geos-devel/attachments/20120530/49737828/attachment.html>


More information about the geos-devel mailing list