0

I have a dataset with 95,000 points/features in and all I want to be able to do is label just a few specific features!

I have worked out how to label individual ones using 'Rule-based labeling' and using the syntax "Contact_ID" = 'MBE_00618' (so that only the MBE_00618 target is labeled), however how do you alter the command so that it can label several targets in one go?

Not having any programming background am I struggling to find a solution.

The only way I have found for labeling multiple specific features is to create a new rule for each one, but is there a quicker, neater way?

Vince
  • 20,017
  • 15
  • 45
  • 64

2 Answers2

1

you can specify multiple targets using in

"Contact_ID" in ('MBE_00618','MBE_00619','MBE_00620')
JGH
  • 41,794
  • 3
  • 43
  • 89
1

As @JGH pointed out you could use the IN operator to add many individual feature but if you have lots of feature to label this solution will quickly reach its limits.

The usual way is to filter from a common attribute (for exemple if you want to label only big city you coud use a field about population count or city rank to filter the big city), unfortunately you doesn't always have a field with the right attribute.

If that's your case the simplest way is to create a new field "IsLabelled" and fill it with '0' values, then you (manually or by location or by any other way) select all the feature to be labeled and update the "IsLabelled" field values to 1 for the selected feature.

after that, you will be able to use rule based labelling with "IsLabelled" = 1 as expression or use the data defined "show label" setting (in the rendering tab of the label property) with the "IsLabelled" field. Both way let you easily choose witch feature to label by just updating a field.

J.R
  • 16,090
  • 1
  • 19
  • 52