0

My stand-alone Python script tries to geocode a CSV file of addresses. The script successfully geocodes this CSV file when using the *.loc file for this locator but not the published REST API.

ArcGIS Server is federated enterprise server (not portal) version 10.8.1, Python IDLE 3.7.9

Is there something wrong with this call to use the REST API?

arcpy.geocoding.GeocodeAddresses(r"M:\sample.csv",

                             r"https://mycity2.houstontx.gov/pubgis03/rest/services/LOCATORS/COH_ADDRESS_ROAD_LOCATOR/GeocodeServer",
                             "'Address or Place' Address VISIBLE NONE;Address2 <None> VISIBLE NONE;Address3 <None> VISIBLE NONE;Neighborhood <None> VISIBLE NONE;City <None> VISIBLE NONE;County <None> VISIBLE NONE;State <None> VISIBLE NONE;ZIP <None> VISIBLE NONE;ZIP4 <None> VISIBLE NONE;Country <None> VISIBLE NONE",
                             r"M:\BARCtest.gdb\sample5_GeocodeAddresses")

From a broswer, this REST API call works but it uses findAddressCandidates() to get results for just one address. https://mycity2.houstontx.gov/pubgis03/rest/services/LOCATORS/COH_ADDRESS_ROAD_LOCATOR/GeocodeServer/findAddressCandidates?outFields=*&outSR=4326&f=pjson&SingleLine=1506%20Johnson%20ST

Error tracebacek from the arcpy.geocoding.GeocodeAddresses() call above.

arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid. ERROR 000005: Could not open the address locator. Failed to execute (GeocodeAddresses).

Another approach I tried (unsuccessfully) was to use an ArcGIS Server connection file to access the locator.

arcpy.geocoding.GeocodeAddresses(r"M:\sample.csv",

                             r"C:\Users\arcgismanager.HOUTX\AppData\Roaming\Esri\ArcGISPro\Favorites\REST_services_on gisproarc04s_6443.ags/LOCATORS/COH_ADDRESS_ROAD_LOCATOR/GeocodeServer",
                             "'Address or Place' Address VISIBLE NONE;Address2 <None> VISIBLE NONE;Address3 <None> VISIBLE NONE;Neighborhood <None> VISIBLE NONE;City <None> VISIBLE NONE;County <None> VISIBLE NONE;State <None> VISIBLE NONE;ZIP <None> VISIBLE NONE;ZIP4 <None> VISIBLE NONE;Country <None> VISIBLE NONE",
                             r"M:\BARCtest.gdb\sample5_GeocodeAddresses")

This gives the following error.

arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid. ERROR 000732: Input Address Locator: Dataset C:\Users\arcgismanager.HOUTX\AppData\Roaming\Esri\ArcGISPro\Favorites\REST_services_on gisproarc04s_6443.ags/LOCATORS/COH_ADDRESS_ROAD_LOCATOR/GeocodeServer does not exist or is not supported ERROR 000005: Could not open the address locator. Failed to execute (GeocodeAddresses).

ESRI Technical Support

This ESRI document talks about an ArcGIS Online locator which I'm not using. It also mentions a composite locator. I was using a composite locator but I switched to a non-composite and still got the same error message.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.