1

I have two sets of LINESTRINGS, each set containing around 50 LINESTRINGS (which form a road), using PostGIS how do I check whether these two sets overlap or not?

1
3

As simplexio pointed out, the ST_Overlaps function is an excellent start; however, you should check out this post that explains some of the nuances and varying behaviours between ST_Overlaps and ST_Intersects - specifically when two geometries are identical.

Here is a query that I use to detect overlaps in a road network - two line geometries that share a line segment. You can remove the t1.id <> t2.id test if you are testing overlaps between two different tables.

SELECT t1.id
FROM t1, t2
WHERE t1.id <> t2.id
AND ST_Intersects(t1.geom, t2.geom)
AND Upper(ST_GeometryType(ST_Intersection(t1.geom, t2.geom))) LIKE '%LINE%
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.