I have a shapefile of parcels which contains an address for each parcel. Some of these addresses are listed as ranges (e.g. 4422-88 Wissahickon Ave). Is there a way to create a new record for each address within that range? I essentially want many addresses associated with a parcel if the parcel contains many addresses. I am assuming it would require the use of a geocoder, but I am not sure how that could be utilized. Any advice would be great!
To just get the numbers create a new field called Number, right click the new field and choose Field Calculator. Switch parser to Python and type the following:
!HouseNum!.split(' ',1)[0]
then click ok
I think the first thing I'd do is clean up those records where the HouseNum ends in N E W or S: Select them as such, and use a python statement smilar to what Tim provides to calc the PreDir field accordingly. Then you can just do a search and replace on ' %' (space any-character) and replace it with '' (no space, no character).
My guess is you got the predirs in your housnum field because there are extra spaces in your address field....
How about if I wanted to remove the predirs in the housenum field, but write them to the actual predir field?
I'm not smart enough to do that in one step. Tim probably is.... timw1984
I thought I was close with this code (ending in "else: return my_direction"):
But it returns <Null> for any row where there is a W, E, S, or N attached to the end of the housenum.
Shannon this worked for me:
Pre-Logic Script Code:
def SPLITTING(test, test2):
if (test2 =='') :
howmany = test.split(' ',1)
if (len(howmany) > 1):
return test.split(' ',1)[1]
elif (len(howmany) == 1):
return
else:
return test2
PreDir box
SPLITTING( !HouseNum!, !PreDir! )
Thanks for your response, Tim. This code does not produce anything for housenum that ends with a W, E, S, or N for me.
This is a direct copy and paste from the table:
449-57 E
I'm not sure if there's a different character or something in that value that's different from what you have.. I get "WARNING 000405: No records within table."
Would you be able to share a view rows of your table and upload it as a shapefile here? The first 4 I see in your screenshot would be perfect.
Whoops! I was working in an older version of that table. It works in this table, though. Thank you!
Glad it works!