I have a set of LineStrings
(streets) and a set of rectangles (atlas pages extents) that could overlap each-other.
And now I want to create a legend for an atlas like
street1, pages: 1,2
street2, pages: 2,3
or
page1, streets: 1,2,3,5
page2, streets: 2,4,5,6
Page numbers are rectangles' attribute. So I need to spatially join attributes, but relations between streets and pages are many-to-many and QGIS Spatial attributes join allows me only two options: write first occurrence or aggregate over attributes values.
In other words, I want to get the analog of Postgis spatial join like below and write it out (in .csv
or other format):
select page.number, street.number, street.name
from
street, page
where
ST_INTERSECTS(street.geom, page.geom)
I could run a python script that will iterate over pages, take streets, and write cross joined attributes into a .csv
file. But maybe somebody already done this before and has published a solution?