My intent is to reverse geocode points, and assign them their nearest address. I have:
My initial standalone script to reverse geocode took entirely to long to do as it was always reverse coding all the points, and as this points will increase it will eventually take longer. So, I thought lets only select from the master point feature class, export those out, reverse geocode the selection, and then join the master feature class to do the join and field calculation.
However, the reverse geocoding keeps crashing. In PyScripter I get an "exceptions.EOFError:[Errno 10054] An existing connection was forcibly closed by the remote host" error. and just running the script cause python to crash.
It does the first part correctly, which is exports out the features with missing addresses, but then crashes on the reverse geocoding part. Below is the code I have thus far. What am I doing wrong? Am I missing something? Do I need to clean up some variables?
# import modules
import arcpy
# Set workspaces
scratchWorkspace = r'C:\ESRITest\GeoReportingSystem\Testing9116\Scratch.gdb'
selectExport = r'C:\ESRITest\GeoReportingSystem\Testing9116\Testing9716.gdb\GeoReporting'
missingAddresses = "Match_Addr"
sql = """{} is NULL""".format(missingAddresses)
print "Export Only missing Addresses"
raw_input("Press enter to continue ;)")
# Select concerns that have missing addresses and send them to a scratch workspace for geocoding
arcpy.FeatureClassToFeatureClass_conversion(selectExport, scratchWorkspace, "NoAddresses", sql)
print "Export Successful"
print "Are You Ready to Start Reverse Geocoding?"
raw_input("Press enter to continue ;)")
# Start edit session
edit = arcpy.da.Editor(scratchWorkspace)
edit.startEditing(False, True)
edit.startOperation()
#Additional Variables for reverse geocoding
needsAddress = r'C:\ESRITest\GeoReportingSystem\Testing9116\Scratch.gdb\NoAddresses'
address_locator = r'C:/ESRITest/GeoReportingSystem/Testing9116/ActiveOnlyAddresses_CreateAd'
outfc = r'C:\ESRITest\GeoReportingSystem\Testing9116\Scratch.gdb\NearestAddress2'
# Reverse Geocode the missing addresses that were selected from the main concern features
arcpy.ReverseGeocode_geocoding(needsAddress, address_locator, outfc, address_type="ADDRESS", search_distance="100 Meters")
print "Reverse Geocode Successful. Would you like to Exit?"
# Close edit session
edit.stopOperation()
edit.stopEditing(True)
raw_input("Press enter to exit ;)")
Solved! Go to Solution.
Ok, after several months of trouble shooting and tech support, I think we have a winner. When the script would run via idle, pyscripter, the task scheduler, etc. it was trying to use the 32 bit-version not the 64 bit-version. It blows up with the 32 bit-version, but is perfectly ok with the 64 bit-version. All I did was reconstitute the script and set it to use the 64 bit-version in the task scheduler and it works.
I will post more if anyone wants to know more.
Hi
See if my tool is an option for you:
http://www.arcgis.com/home/item.html?id=da9efbe1232f426ead182213f53c8cd8
Bruce
Hi Bruce,
I do not think that will be an option for me. We would like to use our own GeoCoder as to not consume a bunch of credits. I appreciate the suggestion.
David.
After looking at into this further. The script produces a geocoded result, but crashes before line 48 "print "Reverse Geocode Successful", and does not delete the unneeded scratch export. Is there a better way of doing what I trying to do? Is something corrupted? I am at a loss.
To see if it is related to the edit session, what if you try the workflow outside of an edit session?
Well I have done a few things. I have run the geoprocessing tool both in ArcMap and ArcCatalog using the same parameters minus the export. I used NoAddresses in Scratch, and used the same locator, same output with no problems. I then spelled it all out in the python window in ArcMap and ArcCatalog and crash. I do not know if it is a 10.3.1 thing or what. So what I have determined thus far is that it is a script thing, as the geoprocessing tool worked just fine.
Even if you were doing something wrong with the script, which I am not saying you are, the application shouldn't crash. I would contact Esri Support because something needs to be addressed.
I was hoping I would not have to, but it looks like that is going to be the answer.
Ok, after several months of trouble shooting and tech support, I think we have a winner. When the script would run via idle, pyscripter, the task scheduler, etc. it was trying to use the 32 bit-version not the 64 bit-version. It blows up with the 32 bit-version, but is perfectly ok with the 64 bit-version. All I did was reconstitute the script and set it to use the 64 bit-version in the task scheduler and it works.
I will post more if anyone wants to know more.