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

Let's say, a road has the name "William-Bill-Gates-Road".

If the road is too short, the label can only be abbreviated by using a dictionary in Maplex. Is it possible to make Maplex try several label fields, if one is not fitting?


name | name_1 | name_2 | ... William-Bill-Gates-Road | William-Bill-Gates-Rd. | W.-Bill-Gates-Rd. | W.-B.-Gates-Rd.

share|improve this question

The short answer is yes.
here is some code that should work in 10.0 and previous.
Grant it doesn't exactly use an alternate field but shortens the word.
I figure you might be able to recreate it with the loop you need.

Function FindLabel ( [Name] )

Dim strArray
Dim outStr
Dim x
Dim maxWordLength
Dim minLengthLength
Dim everyother
Dim isFirst
Dim lastWordLong
lastWordLong = false

maxWordLength = 10
minWordLength = 3
everyother = False
isFirst = True
strArray = Split( [Name], " ")

For x = 0 To UBound(strArray)

    If ((Not isFirst) And (Len(strArray(x)) <= minWordLength)) Then
        'keep short word on existing line
        outStr = outStr & " " & strArray(x)
        everyother = False
    ElseIf (everyother) Then
        'word x is slated to be second word on line
        If (Len(strArray(x)) > maxWordLength) Then
            outStr = outStr & vbNewLine & strArray(x)
            everyother = False
            outStr = outStr & " " & strArray(x)
            everyother = False
        End If
        'word x is slated to be first word on line
        If (isFirst) Then
            outStr = strArray(x)
            everyother = True
            isFirst = False
            If (Len(strArray(x)) > maxWordLength) Then
                lastWordLong = True
                everyother = False
                lastWordLong = False
                everyother = True
            End If

            outStr = outStr & vbNewLine & strArray(x)

        End If
    End If

FindLabel = outStr
End Function

I didn't write it but inherited a map with that vbscript in it.

share|improve this answer
Thanks for the code, but the problem is, the function will run even if there's enough space on the geometry to label the full name. By using "keywords" in the dictionary of Maplex, it tries the normal name first and then looks for a fitting abbreviation. – GIS Student Sep 29 '12 at 13:00

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.