PostGIS: Intersection between line & polygon

المشرف العام

Administrator
طاقم الإدارة
I have a linestrings consist of 2 vertices. I want to get all lines that don't intersects with any polygons on the way. In my example: blue line Not intersects - only touches some polygons, but black line although touches with some polygon, it also intersects another. So in conclusion the result is only blue line.



What I did:

SELECT lines.geom FROM lines, polygons WHERE ST_Intersects(lines.geom, polygons.geom) = false AND ST_Touches(lines.geom, polygons.geom) = true; The ST_Touches seems to work - I guess because the representation of the line-string consist of the vertex that really touches the polygon.

The ST_Intersects not working - The result is that there is no even 1 line that intersect any polygon.

So what I started to thinking: Maybe because in the space where the line intersect polygon - ain't any 'real' representation of the line-string: Because what is line-string? 2 vertices both outside the polygon...

Whats going on? I thought that GEO-DB should deal exactly with this kind of challenges and 'knows' what spatially intersection is...

Thanks,

EDIT:

Altough I don't know how to do this (because ST_Segmentize not worked for me from some reason) I prefer not to overcome this issue with just 'breaking' the line-string to more elements such that with high probability some vertex would be inside the polygon.



أكثر...
 
أعلى