Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a field in a shapefile with values ranging from 1-50 and multiple listed as 0. Is there a way to label only the features where the number in the priority field is > 0?

share|improve this question
up vote 6 down vote accepted

You can put this as the label expression for the feature:

def FindLabel([yourField]):
    if [yourField] is not None:
        if int([yourField]) > 0:
            return [yourField]
            return None
        return None

Using Python as the parser and checking the Advanced box.

Replace [yourField] with whatever field you are using to label.

share|improve this answer
note, in python it's better to say if XXXX is not None: – Paul H Mar 26 '14 at 16:54
Thanks Paul, that's actually what I normally use. I'll update my answer accordingly. – ianbroad Mar 26 '14 at 17:34

I deal with this from time to time. You should use the Expression button in the Label tab. There you use the Advanced parser (checkbox), and write something like this (Python):

def FindLabel ( [Name], [V5] ):
 if [V5] == "0":
   return "<BOL>"+ [Name]+"</BOL>"
  return "<BOL>"+ [Name]+"</BOL>" + "\n" +"<FNT size = '6'>"+  str([V5] )+"</FNT>"

This will return labels for each feature from field Name in bold, and in smaller print the value from V5for those that are > 0 (assuming non-negative values).

share|improve this answer

In Layer Properties - Labels- Method click the drop down to select Define Classes, then use the SQL Query to limit the label to only those features.

Alternately you could use a selection query for those features, save the selection as a new layer in your TOC using the create features option, and then label those features.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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