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.

3

Try ST_INTERSECTS:

select polygons.*
from polygons, lines
where st_intersects(polygons.geometry, lines.geometry)
| improve this answer | |