Select to view content in your preferred language

geocoding using ArcGIS online locator in python

3947
2
08-13-2012 02:50 PM
ramsesmadou
Emerging Contributor
Hello,

I am trying to automate a geocoding process in Python. I would like to run the address through the North America Geocode Service. I work at a university and have the subscription needed to access this service, but can't figure out how to access it. anybody have codes snippets, a walk through or some clues for me?


URL of the service:
http://tasks.arcgisonline.com/ArcGIS/rest/services/Locators/TA_Address_NA_10/GeocodeServer

thank you,
Ramses
Tags (2)
0 Kudos
2 Replies
StephanieWendel
Esri Contributor
Hi Ramses,

You should be able to do this. The only thing you have to do before hand is in ArcCatalog add tasks.arcgisonline to your services.

You can do so with these steps:
1. Look in the Catalog Tree for GIS Services.
2. Expand that and select Add ArcGIS Server.
3. In the dialog, choose Use GIS services. Click Next.
4. For the Server URL, type: http://tasks.arcgisonline.com/arcgis/services
5. Press ok. You should now see arcgis on tasks.arcgisonline.com in that GIS servers list.
6. Expand the connection and expand the locators folder. Select and click on the locator you want to use.
7. Copy the full location path from the Location bar at the top of ArcCatalog.
8. Use that path in this code sample:

# Import system modules 
import arcpy 

# Set local variables: 
address_table = r"C:\Data\Locations\geocodeONLINE\Addresses.dbf" 
address_locator = r"GIS Servers\arcgis on tasks.arcgisonline.com\Locators\TA_Address_NA_10.geocodeServer" 
geocode_result = r"C:\Data\Locations\geocodeONLINE\geocode_result.shp" 

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") 

print "done!" 




Additional code help for this tool can be found at: http://help.arcgis.com/en/arcgisdesktop/10.0/help/#/Geocode_Addresses/002600000006000000/
0 Kudos
ramsesmadou
Emerging Contributor
Just realized I never said thanks. So thanks!
0 Kudos