I am using Atlas in Qgis 3.2 and would like to show municipality area in grey colour like in the picture (I made this using separate layer for a single municipality): enter image description here

My goal is to be able to do the same but for the whole country with Atlas tool. I am already using an expression $id = @atlas_featureid for showing only features contained in the Atlas current feature, which is a commune (not sure if this is the right word in English, it's a part of municipality).

I have a layer for administrative communes (which contains also names of municipalities) and layer for municipalities which I created from the first layer.

I think I should use an additional expression for only the municipality of the current feature to show in grey, but I can't figure it out. Now all I can do is this (different municipality):

enter image description here

  • Did you mean that a commune is a part of a municipality? – csk Aug 26 '18 at 22:45

I assume that there is a field in your commune ("idMUN") table that identifies the municipality it belongs to.

First, in your commune symbology :

  • Select "Rule based" as a symbol
  • Enter the following formula : "Comm_NAME" = @atlas_pagename

assuming you selected the field "Comm_NAME" as your atlas page name (and your commune layer as your coverage layer)

Next, in your municipality symbology :

  • Select "Rule based" as a symbol
  • Enter the following formula : "MUNID" = attribute( @atlas_feature , 'idMUN')

assuming "MUNID" is the field name in your municipalities layer and "idMUN" the corresponding values in the commune layer.

Then, simply add an ELSE rule in the municipality symbology where you will show the other ones.

  • I am not sure how to insert "idMUN" into expression as expression builder shows only fields of the cover layer. – Monika B. Aug 27 '18 at 10:16
  • You have to manually look up your table, and write its name yourself. Note the use of a single quote ' in this case. What happens here is that you query the atlas table to return the value contained in a field. If the field name doesn't exist, NULL is returned. – Kantan Aug 27 '18 at 10:28
  • @MonikaB. Did it solve your problem? If so, please mark the question as accepted by ticking the marker on the left as it helps notifying other users that may have the same question that this is a correct answer. Otherwise I'd be glad to improve it with your input! – Kantan Sep 4 '18 at 7:33

This solution worked partially, but it overlayed the Land use layer, and changing the order of layers didn' help.

So the right solution for me was following:

In the municipality symbology:

  • Select "Rule based"
  • formula for the transarent fill: contains ($geometry, @atlas_geometry)
  • ELSE for all others, coloured with colour for the country

In the commune symbology:

  • Select "Rule based"
  • formula for the transarent fill: "commune" = @atlas_pagename
  • ELSE for all others, coloured with colour for the municipality

Order of the layers should be following: 1.municipalty layer, 2. commune layer, 3. cartogram layer (in my case Land use)

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.