2

I am having troubles labeling my map. I have fire occurrences in some regions in my map and I only want them to be labeled and the other regions with no fire to stay without a label.

I want all the (CAD_names) to appear if only (cadastral_1 > 0) and to be labeled (check image) I tried using "case when" and other stuff but it did not work. Here is my attribute table:

here is my attribute table

7

You have several options to achieve this.

You can label all features using an expression, and instruct to print the CAD_names or Null based on your condition:

if  ("cadastral_1" > 1,"CAD_names",null) 

enter image description here

Another option is to use Ruled Based Labeling, and to create a rule for when "cadastral_1" > 1

enter image description here enter image description here

2

You can use rule-based labeling for that.

  1. Right click on your layer and go to Layer properties
  2. Go to labels
  3. Select Rule-Based Labeling from the drop-down menu.
  4. Add a new rule using the + icon
  5. Next to filter, click the ... icon. enter image description here
  6. In the expression builder, expand the fields and values section
  7. Create filter rule "cadastral_1">0 and close the expression builder
  8. Select the field you want to display as label (CAD_names) enter image description here

Done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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