1

Is it possible to show settlement labels based on population and settlement density in QGIS 3.36?

I have two layers of settlements:

Biggest Cities Layer: This layer contains the largest cities, which are always visible on the map.

Less Populated Settlements Layer: This layer includes smaller settlements, and I want to show these based on the following criteria:

  • Population: Higher population settlements should always be prioritized.

  • Area Settlement Density: In areas with many settlements, I need to hide even large ones (with populations of 100,000 or more). Conversely, in areas with fewer settlements, I want to display even small towns (with populations of 5,000).

Both layers use rule-based symbology (dot size based on population) and labels (text size based on population). I also need to show symbol only when label will be visible.

Is there possible way to achieve this?

enter image description here

1 Answer 1

1

You can create a field named "Settlement Category" and paste this expression , which will give 3 different ID's (0,1,2) based on your criteria.

~
case
when 0 <= "population" AND "population" <= 5 AND 0<= "DENSITY" AND "DENSITY" <=5 then 0
when 5 <= "population" AND"population" <= 10 AND 4<= "DENSITY" AND "DENSITY"<=10 then 1
when 10 <= "population" AND 10<= "DENSITY" then 2
END
~

The values 0,5,10 are indicated , you will decide the value boundaries.

In case that you dont want all of those 3 ID's to be at the same field, you can create 3 separate fields named for example "First Category" , "Second Category" , "Third Category" and paste at the expression of each one separately each expression. For example at the "First Category" field :

~
case
when 0 <= "population" AND "population" <= 5 AND 0<= "DENSITY" AND "DENSITY" <=5 then 0 END
~

etc.

Finally you will have 3 different fields where each one will have an ID based on your criteria.

Hope that helped (if i understood your question correctly).

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.