I have a problem. In my QGIS project,enter image description here all the labels appear the same despite the zoom level. What looks good when the zoom is big, it's not as great when zooming out.

I found a way to get it disappeared, Label display at different zoom level of single shapefile?

but I need it smaller only. Is there any way to set the different font sizes for different zoom levels?

I've already the expression based on one of the table value:

  WHEN "Visible" = 1 then color_rgb (0, 0, 0)

How can I integrate this expression with the answer below?


1 Answer 1


You can set an expression based rule for the font size, something along the lines of :

if(@map_scale<1000, 10, 30 /log(8, @map_scale))

This expression will make so the font size is 9 at a scale of 1:1001 to 5.8 at 1:50000 for example

you can play with the 30/log(8, @map_scale) expression to try to have something that suits you better.

enter image description here

  • How should I integrate it with: CASE WHEN "Visible" = 1 then color_rgb (0, 0, 0) End ? I have already got this expression, which is needed.
    – Geographos
    Aug 27, 2020 at 9:43
  • 3
    @MKR the expression for size and color are put in different place, there are data defined override for almost all label setting, you just put each each expression in it's own place
    – J.R
    Aug 27, 2020 at 10:01
  • I cannot really do that, because I set these expressions for all my font groups. If I do so, then they shift between one rule and another as I zoom in and out.
    – Geographos
    Aug 27, 2020 at 10:05
  • i've edited my answer to show you were you need to set the expression and as @J.R said each attribute of the label can be based on its own expression or field or anything else
    – Kalak
    Aug 27, 2020 at 10:06
  • @MKR what to you mean by "font groups" ?
    – Kalak
    Aug 27, 2020 at 10:08

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.