I have a custom overlay grid whose labels are driven by an ugly attribute field which contains unnecessary leading zeroes and other labeling no-nos.

How can I introduce a labeling expression to this grid?

I am using ArcGIS 10 SP1 for Desktop.

  • is your overlay grid in a raster or vector format?
    – artwork21
    Commented May 12, 2011 at 17:22
  • @artwork21: the overlay grid is driven by a feature class comprised of vector polygon geometry.
    – MLF
    Commented May 12, 2011 at 17:41
  • 2
    Can't you create another column and clean up the values with vb script in the calculator? Commented May 12, 2011 at 17:55
  • 1
    Not to be snarky, but have you read the manual? Commented May 12, 2011 at 20:42

3 Answers 3


You can use many expressions in the label expression dialog.
You might try using regex to get at some of the hard to reach problems.
Here is one of my old questions that can show how it can be used.

If it is just trailing or leading zeros you can use...
Right ([mycolumn],4)

that will drop everything in the front leaving only 4 characters from the right side.

Function FindLabel( [NAME]  )
  Dim fldValue, aWords, i, word, aNewWords, NewWord, numElements, k

  fldValue = [NAME]  

  'k = 0 'One word first line and two words all other lines  
 k = 1 'Two words first line and all other lines

  if not IsNull(fldValue) then
    aWords = split(fldValue, " ")
    numElements = UBound(aWords)

    'Create new array to store new field value and redimmension to store
    ' the correct number of elements to match original number of elements
    aNewWords = Array()
    Redim aNewWords(numElements)

    for i = LBound(aWords) to UBound(aWords)
       if i  Mod 2 = k  then
          word = aWords(i) & vbCr
          word = aWords(i)
       end if
       aNewWords(i) = word

    NewWord = Join(aNewWords, " ")

    NewWord = fldValue
  end if
  FindLabel = NewWord
End Function

This is an example of a label expression from streetmap.


Label expressions for a feature layer may be set by going to the the layers Properties>Labels tab, and click on the Expression button. However, Jakub has a good point that you should clean up your data first via field calculator. Here is the ArcGIS 10 link for feature expressions.

  • 1
    We are a large organization, and use SDE with strict permissions. I am not able to add a field unless I divorce the data from the SDE, and at that point, the end user would not benefit from modifications to the data (and indeed, we are about to update it), so that won't help here.
    – MLF
    Commented May 12, 2011 at 20:08
  • I'm not trying to modify labels on a feature layer. The custom overlay grid is a different beast all its own and does not have the same labeling options as the feature class itself. I want to inject some label class scripting into the actual grid.
    – MLF
    Commented May 12, 2011 at 20:11
  • What do you mean by "a different beast"? Isn't this a polygon feature class with attributes? it would be best to actually clean up the source data with vbscript or python, whichever you prefer. You can of course do it with label expressions but it has certain disadvantages such as slower drawing times... Kirk has provided a link to the manual. Commented May 13, 2011 at 12:52
  • @ Jakub: This is a custom overlay grid. The only options to label a custom overlay grid are to label it according to one field inside the feature class, and there is no option to use a label expression.
    – MLF
    Commented May 17, 2011 at 16:31

Per Esri, it is not possible at this time to incorporate a label expression with a custom overlay grid; Label expressions are not supported with grid labels.

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.