user1228739
user1228739

Reputation: 153

Postgis overlapping two linestrings

I need a specific function to get if two linestring overlaps. e.g. Linestring 1 is Point (0, 0) : Point (10, 0) Linestring 2 is Point (0, 0) : Point (3, 0)

In this case I need "true" result because LineString 1 overlaps in different points like 0,0 1,0 2,0 & 3,0. I dont need the common points, I only need if two linestring overlaps or not. I tried with this function in postgis...

overlaps(buffer(LINESTRING1, 0.001), buffer(LINESTRING2, 0.001))
I create a buffer on both linestrings... but muy problem is some times works better, some times not.

Can you help me please?

Thanks!

Upvotes: 0

Views: 865

Answers (1)

Mike T
Mike T

Reputation: 43662

It's a matter of understanding the spatial predicate terminology used by the DE-9IM, which isn't always intuitive. You don't want "overlaps", but more likely mean "intersects" (i.e. ST_Intersects).

See JTS TestBuilder to get a better understanding of the spatial predicate meanings for different geometry configurations.

Upvotes: 0

Related Questions