jkatzsam

Geocoding: Error000004 : Could not get the address fields

Discussion created by jkatzsam on Jun 13, 2013
Latest reply on Jun 14, 2013 by jkatzsam
Hi,

I've been trying to use arcpy to geocode a set of files, but I don't know what input fields to use. If I try to manually geocode a file one at a time, one of my input fields is "Street or Intersection" and another is "City or Placename", but I'm not sure how to put these into arcpy because of the spaces. When I just put them in as below, I get the error as in the subject. How should I refer to these input fields?  Also, notice that I've tried "Address" and "City" instead and these returned the same error.

#Julian Katz-Samuels
#May 1, 2013
#Geocode addresses

import arcpy

parts=range(10)
parts.remove(0)
parts=map(str, parts)

years=["2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009"]

Geocoder = r"X:\ebruch\shared\Locator\Street_Addresses_US.loc.xml"

#Check that file exists
try:
   with open(Geocoder): pass
except IOError:
   print 'Oh dear geocoder.'

for i in years:
    for j in parts:
        address_table= r"X:\ebruch\shared\HistoryFile" + i + "_part" + j +".csv"
        geocode_result= r"X:\ebruch\shared\GeocodedHistoryFiles\GeocodedHistoryFiles.gdb\GeocodedHistoryFile" + i + "_part" + j + ".shp"
        try:
           with open(address_table): pass
        except IOError:
           print 'Oh dear address table.'
        arcpy.GeocodeAddresses_geocoding(address_table, Geocoder, "Street or Intersection StreetNumStreetName VISIBLE NONE;City or Placename SRmailCITY VISIBLE NONE;State SRmailSTATE VISIBLE NONE;Zip SRmailZIP VISIBLE NONE", geocode_result, "STATIC")
print "Done!"




Thank you,
Julian

Outcomes