4

I am creating a road map and have added a grid to it using the the process in https://kartoza.com/en/blog/create-a-custom-reference-grid-in-qgis-composer/

Is there some tool or a process that's used in QGIS 3 to then assign the id's of the grid squares a feature occurs in, in to a dynamic table?

I can create a workflow as below but I'd rather not if there's already a solution that I haven't been able to find.

  • Create and Export Grid as polygon file (using MMQGIS -- Create - Grid)
  • In field calc create a concatenator filter to get all the grids the feature intersects into a field.
  • Add this table to the layout.

The issue with this is that it won't be dynamic when the view changes and will need to be rebuilt for different scales as the grid will change.

I found https://www.fscbiodiversity.uk/qgisplugin/gr2layerstool that seems to be able to do what's needed but is limited to british grids -is there anything similar that will work based on the current grid?

So what I need is in a map like enter image description here

I want

Norman St | B2
Massey Dr | A2, B2
Yappar St | A1, A2, B2, B3, C3
Carmo St  | B5
4
  • Sorry to ask but ... doesn't it look like a simple query between your grid layer and your street layer ? ... that could be "dynamic" (something like a postgis view) ? – Snaileater Jul 31 '19 at 13:08
  • Yes but the grid is dynamic and will change as you zoom in/out so the references will change. – GeorgeC Jul 31 '19 at 13:18
  • I'm sure (never tried ...) u can programmaticaly connect a refresh of your query to a zoom of your map (and maybe restrict the data update to your map view's extent) ... but i don't know how "light" or "heavy" the calculations would be ... – Snaileater Jul 31 '19 at 13:26
  • I haven't browsed the links you gave but ... how "dynamic" is your grid layer ? – Snaileater Jul 31 '19 at 14:11
2

I am not sure if that is the solution to what you want to achieve: your grid is fixed, and the relation between streets and the grid cells is also fixed in your table. You can restrict the table to show only the visible streets in your map - just select the table and use the feature filtering property in the item properties of the table. Finally only the visible streets with the relation to the grid cells will be visible in the table. If you change scale or extent, the table will also change. See the graphic below:

enter image description here

1
  • Thanks -in this situation though there is no table as when you zoom in/out and pan around the grid changes. I just wanted to know if there was a process then that would have a virtual table that shows the grid squares where the feature exists. – GeorgeC Jul 31 '19 at 23:29
2

In the end I had to use a static implementation.

I created the indexed grid with Create a grid with all polygons labelled - Index style

and then used the following to get the grid reference.

aggregate(
layer:= 'Grid',
aggregate:='concatenate',
expression:=Name,
concatenator:=', ',
filter:=intersects($geometry,
geometry(@parent))
)

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.