Address Field Calculation Question

389
1
05-08-2017 10:08 AM
ChaseHowse
New Contributor

I have a feature class table that includes a text field that contains an address string, i.e.: 123 W Walnut Street. I need to end up with two additional fields, one with JUST the leading address number (BLDG_NUM) and then, everything AFTER the number in another field (STREET). I don't need DIR, TYPE or anything else about the full address string broken out of the original string. None of the geoprocessing tool "Standardize Addresses" locator types include this type of split. I'm thinking the statement known as splitList might help, but i don't know the syntax. Can anyone help?

0 Kudos
1 Reply
JoshuaBixby
MVP Esteemed Contributor

If you are not adverse to using Python, there are options available.  I guess you could even package the following up into a tool if you really wanted.

Since you are only interested in parsing, and not validating, the addresses; there are several Python packages available for parsing addresses, particularly US-based addresses.  One of them being usaddress:

>>> import usaddress
>>> 
>>> address_string = '123 W Walnut Street'
>>> address_dict = {v:k for k,v in usaddress.parse(address_string)}
>>> address_dict
{'StreetNamePostType': u'Street', 'StreetName': u'Walnut', 'StreetNamePreDirectional': u'W', 'AddressNumber': u'123'}
>>> address_dict['AddressNumber']
u'123'
>>> address_dict['StreetName']
u'Walnut'
>>> 
0 Kudos