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

Jasmin FORMONT JFORMONT at siradel.com
Wed May 30 04:08:56 PDT 2012

Unfortunately, PostGIS is not an option here.
Anyway, thanks for the quick answer.
-----Message d'origine-----
De : geos-devel-bounces at lists.osgeo.org [mailto:geos-devel-bounces at lists.osgeo.org] De la part de Sandro Santilli
Envoyé : mercredi 30 mai 2012 12:59
À : GEOS Development List
Objet : Re: [geos-devel] how to know if two linestrings "really" cross each other

On Wed, May 30, 2012 at 12:40:19PM +0200, 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.

I can't think of an easy way to do that.

I'd note that for the "split" case there's no way to walk on all segments
of your first geometry w/out stepping over segments of the second.
You can in the "no real cross" case.

You could then look at the planargraph. Not available trough the C API.
Hard trough the C++ one. I guess you could do it with a nice SQL query
with PostGIS 2.0 topology ;)

geos-devel mailing list
geos-devel at lists.osgeo.org

More information about the geos-devel mailing list