Select to view content in your preferred language

Using Online Geocoding Service in Python Script

3647
1
12-22-2012 06:27 AM
CharlesGant
Occasional Contributor
All,

I have seen a few old posts on the board reffering to this issue, but not seeing any solutions.  Does anyone know how to do this?  I'm trying to use the 10.0 North America Geocode Service in the following script but I get the following error:

ERROR 000732: Input Address Locator: Dataset http://aserver/arcgis/rest/services/locators/streetaddress/GeocodeServer/10.0 North America Geocode Service does not exist or is not supported

#Needed Lists
csvlist = [pdrivedir + 'Spotters.csv', pdrivedir + 'Contacts.csv']

for csv in csvlist:
    print 'Geocoding: ' + str(csv)
    # Set local variables:
    address_table = csv
    address_locator = r'http://aserver/arcgis/rest/services/locators/streetaddress/GeocodeServer/10.0 North America Geocode Service'
    if 'Spotters' in csv:
        geocode_result = rdrivedir + "Spotters"
    if 'Contacts' in csv:
        geocode_result = rdrivedir + "Contacts"
    
    arcpy.GeocodeAddresses_geocoding(address_table, address_locator, "Address Address VISIBLE NONE;City CITY VISIBLE NONE;State State VISIBLE NONE;Zip Zip VISIBLE NONE", geocode_result, "STATIC")
Tags (2)
0 Kudos
1 Reply
CharlesGant
Occasional Contributor
After further research I found the solution.  Had to refer to the following thread post.
http://forums.arcgis.com/threads/64590-geocoding-using-ArcGIS-online-locator-in-python

Final working code is below in case anyone ever needs a sample. 

#Needed Lists
csvlist = [pdrivedir + 'Spotters.csv', pdrivedir + 'Contacts.csv']

for csv in csvlist:
    print 'Geocoding: ' + str(csv)
    # Set local variables:
    address_table = csv
    address_locator = r"GIS Servers\arcgis on tasks.arcgisonline.com\Locators\TA_Streets_US_10.geocodeServer"
    if 'Spotters' in csv:
        geocode_result = tempdir + "Spotters"
    if 'Contacts' in csv:
        geocode_result = tempdir + "Contacts"
    
    arcpy.GeocodeAddresses_geocoding(address_table, address_locator, "Address ADDRESS VISIBLE NONE;City CITY VISIBLE NONE;State STATE VISIBLE NONE;Zip ZIP VISIBLE NONE", geocode_result, "STATIC")
0 Kudos