[GIS] QGIS Atlas: Filter maps based on attributes (more than one)

atlasfilterqgis

I have a series of maps with the same geographic boundaries but with different set of points (from the same layer).
I would like to create an Atlas where the change is based on the attributes.

A table for example:

| ID | Party | Name    | Year |  
|  1 | Rep   | Trump   | 2016 |  
|  2 | Dem   | Clinton | 2016 |  
|  3 | Dem   | Sanders | 2016 |  
|  4 | Dem   | Obama   | 2012 |  
|  5 | Dem   | Romeny  | 2012 |  

I would like to autogenerate 4 maps, each shows the location of the relevant representatives by their Party + Year.

Best Answer

  • You need a polygon layer which will be your atlas coverage layer:

    1. Since all the maps will have the same geographic boundaries just create a layer with a polygon that covers the whole area and make as many copies of that polygon as 'Party' + 'Year' combinations.
    2. Add a party_year field that you will populate with the different combinations of Party and Year.
  • Now set your atlas with that layer as your coverage layer and use the field party_year to name the atlas pages. Remember to check the 'Hidden coverage layer' option as you don't want your coverage layer to show.

  • To shows the location of the representatives based on their Party + Year, render your point layer using a rule based style with this rule:

    concat("Party","Year") = attribute(@atlas_feature, 'party_year')
    
  • Navigate though your atlas pages to see the result.

Related Question