Simple VBScript Label Expression for labelling Highway names on a map

06-12-2012 01:58 PM
New Contributor II
What is the VBScript Label Expression for labelling Highway names - the numerical text only (which is usually the last one to three digits of a road name) in ArcGIS 10?

For example, I want to label "Highway 404", or "Highway 1" on a map, but want to label them with an oval symbol with the highway number on it.

Because I found the convert labels to annotation is not efficient if you have so many roads on a map (Like it is not efficient if I have to change the highway names one-by-one).

Note: I don't have solid knowledge in programming codes, and therefore, need some help that would enhance my cartography workflow in school work.
So what I know is very limited, like I only know how to use the label expressions of UCase([Name]), or LCase([Name]).
Tags (2)
0 Kudos
2 Replies
Occasional Contributor III
To label highways with specific symbol find required text symbol in Symbol Selector:

If you want to extract a highway number from string in pattern "Highway X(XX)" use simple expression:
Mid([Name], 9)

If a string before a number has changing length or more than one word,
select Advanced in Expression section and use the code which split name into chunks divided by space " " and take the last one:
Function FindLabel ( [NAME] )
  a = Split([NAME], " ")
  b = a(UBound(a))
  FindLabel = b
End Function
0 Kudos
New Contributor III
I wanted to something similar with split and even though this is not exactly the same question, I wanted to post my result because your solution helped me with mine (thanks!).  I have a field in a shapefile export that contains the compliments for a Fiber separated by a | character.  My solution was to create the first part of the label then to iterate through the elements in the split to keep adding:

    a = SPLIT([FIBERCOMPL], "|")
    b = _
        [TOTALFOOTA] & "'" & vbCrLf& _
        [ROUTE] & vbCrLf& _
    For Each x In a
        b = b & vbcrlf& x
    FindLabel = b
End Function
0 Kudos