0

I want an SQL query in Spatialite to return a list of values (Primary Key in this case, but could be any value) from all the polygons which are crossed by a line. Say, for example, a footpath passes through several fields and I want a table of the field numbers of all the fields the footpath passes through.

I've tried playing around with st_crosses, but that only returns a single result.

closed as off-topic by Jochen Schwarze, PolyGeo May 4 at 20:56

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – Jochen Schwarze, PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

4

Try ST_INTERSECTS:

select polygons.*
from polygons, lines
where st_intersects(polygons.geometry, lines.geometry)

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