Geocode only one address in arcpy.

3101
3
04-16-2013 01:11 AM
AbdelOuedraogo
New Contributor
hello,
i would know if existing a method in arcpy to geocode just one address. There is the function  arcpy.GeocodeAddresses_geocoding but i want something not work with address table and not create a feature class result. A method that you can pass it the locator and the address and it will give you the position.
An idea? Thank you.
Tags (2)
0 Kudos
3 Replies
ChrisFox3
Occasional Contributor III
With a geocoding service it would be possible to send a request to the service using the address and return the result without ever creating a table or feature class. Otherwise I think the simplest thing to do would be to just create and in_memory table and write the address to a field and then write the output to an in_memory feature class. The in_memory input and output would just be temporary in the script.
0 Kudos
AbdelOuedraogo
New Contributor
Thank you. Since this is a single address, I would have preferred optimize the execution time of this geocoding operations avoiding file manipulation.
0 Kudos
KimOllivier
Occasional Contributor III
Send a request to Google's geocoding service and you can get back a single address. There is a limit of 50,000 in a day. Since it has to go off across the internet it may not be faster than using in_memory featureclasses (that is not a real file). Did you miss the clever trick suggested by Chris Fox using in_memory as a virtual disk drive?

I assume that if you want a fast response from one address you are trying to geocode a lot of them? If so, take out the loop and geocode them all in one featureclass that will be really fast. You should expect 1 million per hour if done locally on real files.


Here is a way to use Google:

# geopy example
# http://code.google.com/p/geopy/wiki/GettingStarted

from geopy import geocoders
apikey = "your_api_key_adfvaklfmuyrdghbndfzcvazdfzcvsfgsfvsfgsdfbvsfgsghsdfgd"

g = geocoders.Google(apikey)  
place, (lat, lng) = g.geocode("380 New York Street,Redlands,California,USA")  
print "%s: %.5f, %.5f" % (place, lat, lng)
 
0 Kudos