Wednesday, 7 September 2016

qgis - Labeling expression to label one value in a attribute table column


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?



Answer



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.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...