3

I am working with a layer of administrative areas. The administrative area in focus needs to have no label and a drop-shadow around it; surrounding administrative areas do need to have the label. E.G. Andorra would have a drop-shadow and only 'France' and 'Spain' labels would be visible, 'Andorra' being filtered out. Currently, I am achieving this by duplicating the layer and applying to one layer just drop-shadow whilst hiding surrounding polygons and in the other layer I am hiding the polygon in focus and show the surrounding labels.

How, and where can I run a query like

if (name = 'a', 
    show labels for (name != 'a') AND apply drawing effects,
   )

This will avoid duplicating the layer for every administrative area I have to apply my styling.

Do you have any suggestions?

2
  • Which GIS software?
    – Mapperz
    Commented Mar 27, 2021 at 21:32
  • Sorry, QGIS 3.14.15 Commented Mar 27, 2021 at 22:14

1 Answer 1

2

If you use QGIS, than set a rule based rendering for both the symbology as well as the label. Define two rules - for demonstration purpose, I use Czechia: one rule is "NAME" ='Czechia', than copy that rule and paste it, change it to "NAME" <>'Czechia'.

Than double click on the first rule, where you can set the style/label visibility accordingly for the administrative area in focus. When finished, double click the other rule and make the settings for all other areas. Repeat this for styling and labels.

enter image description here

2
  • Thank you Babel, That is indeed helping me to avoid loading the layer twice. But what if I want to load a style to the rule I just created? Commented Mar 27, 2021 at 22:16
  • 1
    I think I figured it out. The style is added to the layers and rules are filters of those styles, and a filter is not capable to load styles. Thanks again, I think this question is answered unless there are some other ways to achieve rule-based styling. Commented Mar 27, 2021 at 22:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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