I'm wanting to label polygons on a map that are above a certain area. These polygons are dervied from open streetmap and consist of either ways or multipart polygons ie If polygon is more than 160 sq m label it. I'm doing this using;

$area => 160

But nothing is being returned. The table has no specific area column but is comprised of polygons. On the fly transforms are enabled with all the source data in WGS 84 projected to a local national grid. The project CRS area is set to square metres as discussion in comments below.

What am I doing wrong?

  • 4
    Could also be projections, $area will be in the units of the CRS you are using. Also if you want bigger, then it is >= instead of <=, which is smaller. Commented Apr 3, 2017 at 12:14
  • Apologies there are no quotes that was me trying to use a back tic Commented Apr 3, 2017 at 12:20
  • 2
    I suspect it's just a typo, but you say you want to select for areas more than 160 square meters while your code selects for 1600. And as others have pointed out, you're using the less-than symbol (<) when you should be using greater-than (>).
    – Dan C
    Commented Apr 3, 2017 at 16:02
  • @Vesanto the CRS is definitely part of the puzzle if i select the feature i want to label it tells me that the area is 79 hectares but the CRS says its calculating areas in square metres. Even if i set CRS units to match those in the table it still doesnt work ie. no label added Commented Apr 5, 2017 at 7:09
  • You should label it with just $area, that will give you an idea of the units it is using. Commented Apr 5, 2017 at 8:11

2 Answers 2


Right-click on the layer from the Layers Panel and then go to Layer Properties > Labels and choose the label you want to use from the Label with drop-down list (after having selected the Show labels for this layer option).

Then, go to Expression Builder and try to use a CASE WHEN expression. Something like this:

$area > 1600

In this way, the label will only appear if the area is larger than 1600 .

I don't know why you want to use a rule-based labeling (there are probably other rules that you didn't explain), but the same expression should work also for that case.


As suggested from @GuiOm Clair, another way is using an if statement:

if( $area > 1600,  "field_name_for_the_label" , None)
  • 1
    Another way is to use an if statement. Commented Apr 3, 2017 at 13:50
  • 1
    @GuiOmClair thanks for the hint! I hope your idea was what I reported in my edited answer.
    – mgri
    Commented Apr 3, 2017 at 14:01
  • 1
    This is absolutely what I was refering to. Thanks for the edit. Commented Apr 4, 2017 at 6:39
  • Thankyou @mgri The expression works but still get errors as above Commented Apr 5, 2017 at 7:18
  • @mappingdom That's weird... Are you using layers with projected CRS? Setting the CRS is not enough for having it in a projected CRS. Starting from your layers in WGS84, it would be enough right-clicking on it, then going to 'Save as' and choosing a projected CRS.
    – mgri
    Commented Apr 5, 2017 at 11:41

You could try adding a new field in the table, with the area calculation and use that field instead of '$area' to give the labeling rule. Does it works?


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.