Proper Case Label exceptions

891
5
10-24-2016 09:54 AM
GregJohnson
New Contributor III

We have created auto labels expression for proper case for an ArcMap, Data Driven Page document. I noticed there are some exceptions where the proper case label is not accurate (e.g. Crete-monee Rd, I 355 Nb). It has been awhile since I programmed. I assume I need to add an if-else if-else loop within the For loop (see attachment) to identify the hyphen names and the highway names to rule them out either in separate loops or as exceptions to the remaining names. I could also put those two name types in separate classes of labels to make sure they appear correctly (e.g. FULLNAME like '*-*'). Thoughts?

0 Kudos
5 Replies
MicahBabinski
Occasional Contributor III

I think you're on the right track. Does your data only have a FULLNAME attribute or are the address components broken out in other attributes?

0 Kudos
GregJohnson
New Contributor III

Only the FULLNAME attribute.

0 Kudos
MicahBabinski
Occasional Contributor III

Hi Greg,

That makes it tricky. Correcting the casing on the source data might be more worthwhile in the long term, assuming you have control over the data and can do that. Either way, you'll need to parse the components of the FULLNAME value. Are these intersections? I was think that 'Nb' meant New Brunswick but I think it means Northbound.

Assuming that's the case, your FULLNAME components would be (I think):

Street Name ("Crete-Monee")

Street Type ("Rd")

Highway Name ("I 355")

Highway Direction ("NB")

Is that correct? Assuming your data is formatted consistently with the example you gave, it would be possible to parse those components and correct them in the source data. You could use an arcpy.da.Update cursor pretty effectively to do that.

Some questions to consider:

Do you want a hyphen for interstates?

Are there other types of highways (non-interstates) in the data?

0 Kudos
DanPatterson_Retired
MVP Emeritus

I don't know what language applies to labelling but in fields if you use the python parser youy should be able to play with this idea

>>> import string
>>> z = 'Crete-monee Rd, I 355 Nb'
>>> zz = z.casefold()
>>> zz
'crete-monee rd, i 355 nb'
>>>
>>> string.capwords(zz, sep=" ")
'Crete-monee Rd, I 355 Nb'

If I am not mistaken the string module is already imported in the field calculator, if you  set the parser to python.  I ddon't if string.capwords is in there, but it might be worth a look

0 Kudos
DanPatterson_Retired
MVP Emeritus
0 Kudos