I have a vector table of road sections across the UK. I also have a vector table of 1km grid squares. For each road section, I want to report all the grid crossed. In QGIS Using the 'join attributes by location' function, it only reports the central grid square. However, some sections of road cross several sections and I want to report all squares crossed by the road section.

I am relatively newb to QGIS.

  • Have you tried the intersect tool? – firefly-orange Feb 12 '18 at 9:41

You want the Select By Location tool. It's under the menu Vector -> Investigation Tools (or something). Choose the layer you want to select from (in your case, the polygons), and the layer you want to act as a location restrictor (the lines). Then, you choose a spatial relation. You may see "Crosses" in the list, but that means a line must enter and exit a polygon, otherwise the polygon won't be counted. If that's what you want, then that's the relation for you, if otherwise you just want any polygon your lines touch upon, then go with Intersects.

Single line intersection selection

Then you can export only the selected polygons in a new layer. A few things to note, however:

  • Your lines layer and your grids layer must be in the same Coordinate Reference System, otherwise the selection will return incorrectly.
  • This tool measures all lines against all grids. If you just want to know all grids that are crossed by any one (or more) lines, then it's fine. If, however, you want to know which grids are crossed by which lines, then you'll need to first select each individual road, and do this procedure. If you have selected feature(s) in your restrictor layer, the tool will only use those to evaluate which polygons are crossed by.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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