I'm using QGIS 2.18 (Las Palmas). I have an attribute table with 75 municipalities and around 50 attributes. I would like to creat a map for each of the attribute (always showing all of the municipalities at once) in graduated categories (preferably with values). I know that by using the Atlas-Function i can create a series of maps, but it seem like i can only do that for each of the municipilities but not for the attributes. I have looked around in Stackexchange and i found similar questions that were unfortunately unanswered. I also read that you should tranpose the data, but i fear that i wouldnt be able to see the municipalities any longer. Any suggestions?
-
The answer to this question may help you get started: gis.stackexchange.com/questions/78837/…– cskCommented Apr 7, 2017 at 15:51
-
CSK, I have followed your steps to atlas map over fields and I am able to get the map over fields but my legend is not changing. How to change the legend in the print composer?– Dhananjayan MCommented Jun 14, 2023 at 6:34
1 Answer
Step 1: Categorize your original shapefile
Stylize your original shapefile with graduated categories based on the first of your 50 attributes.
Rename the layer (NOT the original shapefile) to include the name of the first attribute. Eg, this layer would now be called LayerName_Attribute1
Duplicate the layer
Layers Panel > right click on the layer name > "Duplicate"
Set up graduated categories for attribute number 2. Rename this layer as LayerName_Attribute2
Repeat until you have 50 or so layers, one for each attribute. Note that you haven't created any new shapefiles, so if you make changes to the original shapefile all of your layers will also be updated.
Step 2: Make a coverage layer
Create a new polygon shapefile, let's call it coveragelayer. Add one text field, "Attribute Name". Make a polygon that encompasses all of your municipalities. Copy and paste that polygon until you have one polygon for each of the 50 attributes. In the text field, give each polygon a unique title that corresponds to each of the 50 attributes (Attribute1, Attribute2, ...)
Step 3: Create a visibility preset for each layer
In the layers panel, turn on "LayerName_Attribute1" and any other layers you want in your atlas. Create a visibility preset called Attribute1. Turn off "LayerName_Attribute1," turn on "LayerName_Attribute2" and create another preset called Attribute2. Repeat until you have a visibility preset for each attribute.
Step 4: Generate an atlas
In Print Composer, create an atlas using the layer created in step 2 as the coverage layer. Set the atlas pagename to the text field "Attribute."
Add a map to the layout and check the box for "Controlled by Atlas." Under the map's
Item Properties > Layers > check the box for "Follow visibility preset" > click the button for "data defined override" > Edit
Enter the expression
@atlas_pagename
Note that the layer visibility is controlled by the coverage layer field called "Attribute." If the layers don't display correctly, go back and check that the values in this field are identical to the layer visibility preset names.
-
1csk, i finally got around to tryout your approach and it worked wonderfully. thank you so much for your help, its definately less time consuming than creating a seperate map for each attribute!– rtaaniCommented May 31, 2017 at 15:27
-
1I'm glad I could help. Please consider clicking the check mark next to my answer to accept it as the best answer to your question.– cskCommented Jun 21, 2017 at 19:02