4

Our county road data has road names for all roads in the county. In the attribute name field, there are some entries with all uppercase for the road name and some with mixed case. I would like to go about switching the road name attributes all to mixed case just for uniformity throughout the county data.

How can this be done?

I know I could assign someone to manually edit every record into Mixed Case, but I'd like to try to perform this as one single efficient process if possible.

I've looked into Field Calculator and it looks like there could be an answer there, but I'm having trouble identifying which of the processes would work. I don't mind exporting it and working the table in Excel and then rejoining it after it's cleaned if that's truly the best way. We have 33,906 road segments.

I've attached some screenshots as examples.

enter image description here

enter image description here

enter image description here

0

2 Answers 2

6

In ArcGIS Field Calculator, you can use a simple Python expression with the string.capwords function to capitalize only the first letter of each word and change everything else to lowercase. Select Python as the Parser, and check the Show Codeblock option. Then, in Pre-Logic Script Code enter:

import string

Then in the box below that the code should be (replacing "test" with the name of your field):

string.capwords(!test!)

enter image description here

4
  • Thanks a bunch, this worked perfectly. This is exactly what I needed. I created a new field and calculated it per your instructions on the old field and it returned solid results throughout.
    – Joshua A
    Nov 27, 2019 at 17:20
  • 1
    Great to hear, @JoshuaA. Glad that was what you were looking for.
    – lambertj
    Nov 27, 2019 at 17:31
  • 3
    This is doable without importing string module, just use .title()
    – FelixIP
    Nov 27, 2019 at 18:59
  • 2
    Be aware when using .title() that it may affect letters after apostrophes e.g. felixip's.title() would potentially come out as Felixip'S. (stackoverflow.com/questions/8199966/…). Probably not an issue with road names but just in case.
    – SMiller
    Nov 27, 2019 at 20:12
4

There are code samples for converting to Proper case in the ArcGIS help for field calculation. I can't tell if that is what you want but it is what I would expect in addresses. Proper case capitalizes all of the words, including minor/stop words such as "the." Title case does not capitalize minor words. I have seen title case functions, probably in MS Word, but not recently.

Excel 2013 does have a Proper case text function that works well. I used both Excel and ArcGIS functions when having to convert to large amounts of text to camel case (which required some final manual edits).

2
  • 2
    As a rule, I try to keep GIS data at least 5 meters from Excel, just to avoid the Aura of Corruption (3m).
    – Vince
    Nov 27, 2019 at 22:49
  • The OP brought up Excel.
    – danak
    Nov 29, 2019 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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