Thursday, 25 July 2019

qgis - How to generate multiple maps where one highlighted attribute changes?



I have a layer that contains counties within the state of Washington.


I need to build one map (jpg) for each county. For that specific map all counties will show as light grey, but the specific county will be green, and the file name will be the county name.



Answer



What you want is creating the Atlas.



  1. In print composer, go to Atas generation tab and check Generate atlas.

  2. As covarage layer set your counties layer, and as output set your name of counties attribute (somtheing like "counties_names").

  3. Go to layer properties and set rule-based symbology, create empty rule with grey color and in this rule nest a rule like $id = @atlas_featureid with green color (see picture below).


enter image description here




  1. Go back to print composer and start preview of atlas (in atlas panel or menu Atlas --> Preview Atlas. Now you can browse atlas features by Next feature and Previous feture and so on.

  2. If you wnat add other items like text fields, scalebar etc. (You can also control text fields by expression, so you can get for each atlas feature uniqe text fields values, for example counties names.)

  3. Export via atlas panel or menu Atlas --> Export Atlas as Images...


Possible output (one of exported images):


enter image description here


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...