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 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.

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

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.

share|improve this answer

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.

share|improve this answer
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 May 12 '11 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 May 12 '11 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. – Jakub May 13 '11 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 May 17 '11 at 16:31
up vote 1 down vote accepted

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.

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.