TransWikia.com

QGIS 3x setting scale-based label color

Geographic Information Systems Asked on May 5, 2021

I want to have a different color for my label when zooming out.

I’ve prepared an expression, which is not valid

 CASE 
 if(@map_scale>1750, (color rgb 128,128,128))
 else
 "auxiliary_storage_labeling_color"
 end   

There is a good example here:

Setting different colors based on value when labeling using QGIS

but applies to the certain data attribute table feature.
How to write a scale-based expression?
What have I done wrong in my case?

One Answer

The correct syntax for your expression is:

if(@map_scale>1750,color_rgb(128,128,128),"auxiliary_storage_labeling_color")

or

Case
When @map_scale>1750 Then color_rgb(128,128,128)
Else "auxiliary_storage_labeling_color"
End

Correct answer by MrXsquared on May 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP