I would like to programmatically figure out whether they intersect or not. So, I do:
select ST_Intersects (
(
select ST_SetSRID(ST_Buffer(ST_Transform(ST_SetSRID((p.geom), 4326), 26986), 50), 4326)
from point p
where p.id = 25785
)
,
(
select ST_SetSRID(ST_MakeLine(ST_SetSRID(p.geom, 4326)), 4326)
FROM point p
where p.trajectory_id = 1455
)
);
But when I run the query, PostGIS says that they do not intersect!! But on the picture above we definitely see that they intersect (or line crosses the polygon).
What is the problem?
I also tried ST_Crosses
function, but it also gives false.
ST_MakeLine
clause is working? Is it the messy blue line in you map? Also, there are many questions on GIS SE apparently involvingST_Buffer
that actually are far better expressed using theST_DWithin
function. Investigate a few Qs here aboutST_DWithin
. Finally, i agree: you seem to have too many instances ofST_SetSRID
, making your query hard to manually parse.