[GIS] ATLAS automation in QGIS showing data from multiple layers (based on attribute from one of the layers)

atlasqgis

I have a QGIS project with four layers: A, B, C and D.

I need to prepare an ATLAS automation based on layer A. On maps I want to see data from layers B, C and D (from A not necessarily) but the data needs to match to the attribute from table A selected for automation (the Coverage layer = Layer A, Filter with = values from 'Feature ID' column, Sort by = values from 'Feature ID')

Example:
Layer A – ATLAS automation based on values in attribute table from column: 'Feature ID' = 100, 101, 102 and so on.

Data from layers B, C, D visible on maps: features from layer B (C, D) where values in each attribute table from column 'Layer A Reference No' = 100, 101, 102 and so on.

I don't want to see the other features from layers B, C and D (where values are different than the ones selected for ATLAS automation (for example 87, 88 or 94)) for layer A – only the ones which match.

In the end I would see on the first map the data from layers B, C and D where attributes in the column 'Layer A Reference No' = 100 as this is the first map selected by ATLAS (based on Coverage layer A).

On the second map (where ATLAS selects value 101 from layer A) I would see only the data from layers B, C and D where attributes in the column 'Layer A Reference No' = 101.

Is this possible without Python?

At the moment the only thing I can do is to query layers B, C and D in order to see on the map the data where the value in the column 'Layer A Reference No' = 100 (for the first map), 101 (for the second map) etc. and then use layer A for setting location.

But I have to prepare 200 maps!

Best Answer

I have found the solution.

Atlas generation TAB

Layers B, C and D

They need to be rule based (style) and need to contain the following rules (in Style):

"Feature ID" = attribute( $atlasfeature , 'Feature ID') - for visible records

"Feature ID" <> attribute( $atlasfeature , 'Feature ID') - for all records we don't want to see ( I styled it as transparent)

.....................................................................................................................................................................

Settings for the layer A, which works with ATLAS:

Configuration section:

Coverage layer: A

Hidden coverage layer: - TICKED

Filter with - NOT TICKED - this is important as the automation won't work otherwise

Output section:

Output filename expression: attribute($currentfeature, 'Feature ID') - this is not mandatory but will produce single files with the name = to the values from Feature ID column

Single file export when possible - NOT TICKED - this can be ticked in order to create a booklet, but not in my case

Sort by: Feature ID

.....................................................................................................................................................................

Item properties TAB

Below are my settings for the Map in the Item properties panel

enter image description here

.....................................................................................................................................................................

Thanks Jesse again. I hope this will help the others as well at some point.

Regards, Maciek Drozda