1

I am using QGIS 2.0 on Windows. I have a shapefile for a point layer that has the the following attribute table: Attribute Table

I am trying to label using the Status column and only want the value that equals Office Location to show on the map. I tried the expression Status = 'Office Location' and I get either a 1 or a 0 show on the map. I cannot figure out the appropriate expression to do what I want and I haven't been able to find anything specific to this on here or through a Google search.

I could just make another column an only provide data for the specific values that I need, but that seem counterintuitive.

How do I label a single value and not show the other values?

2

You can do that a Case Else expression under conditionals in the Function List. Try this in the Expression based label editor:

CASE WHEN  "Status"  =  'Office Location'  THEN  "Status"  END

It gets slightly more complicated if you have multiple Office Locations and you only want to show one. You could always insert one CASE WHEN THEN statement into another. But that might not be the best solution.

  • 1
    Awesome, thank you. Is there some source that I could read to find this stuff out? Is it just knowing Python? – LandArch Mar 12 '14 at 18:54
  • 1
    It's just QGIS's version of an if statement. The conditional goes between CASE WHEN and THEN, and the result goes between THEN and END. QGIS has a list of functions in the Expression based label editor and displays syntax info and examples when you select a function. – midfield99 Mar 12 '14 at 19:02

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.