2

I'm using Tiger road files and I want to label the highways with their shield number. Tiger has an inconsistent naming convention for road features; I am specifically concerned with the highways. I have defined 3 seperate label classes: interstate, US, and state route. For each I applied an SQL query of their corresponding route types.

The part I am struggling with is creating a label expression for each that would include only the last SET of numbers. I say "set" because there are varying numbers of characters annotating the highway number.

Example: US Hwy 24, US Hwy 6, State Hwy 78 N

Is there a way to include only the highway number for the label?

  • 2
    Using your example what would you want the label to show? – Hornbydd Jul 9 '15 at 19:58
1

Update: I found the solution in the following link under "Extract a number." Be sure to select "advanced" in the label expression dialog.

http://support.esri.com/en/knowledgebase/techarticles/detail/20154

1

Here is another option using python within the label expression (less code):

def FindLabel ( [MYFIELDNAME] ):
  try:
    return ''.join(i for i in [MYFIELDNAME]  if i.isdigit()) 
  except ValueError:
    pass

Make sure you change the Parser to Python and check the Advanced checkbox.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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