Esri / arcgis-python-api

Documentation and samples for ArcGIS API for Python
https://developers.arcgis.com/python/
Apache License 2.0
1.87k stars 1.1k forks source link

Unable to geocode using a stand alone arcgis server geocoding service #1644

Open anandak opened 1 year ago

anandak commented 1 year ago

Describe the bug Using Python API v2.1.0.3 We are working with a standalone arcgis server that hosts a secured geocoding service. We are able to successfully initialize the server object and get the geocoding service and construct the Geocoder object. However the batch_geocode operation fails with an error 'Geocoder' object has no attribute 'find'

To Reproduce Steps to reproduce the behavior:

from arcgis.gis import server
from arcgis.geocoding import batch_geocode, Geocoder

server_base_url = "https://fqdn/arcgis"
# initialize server connection
gis_server = server.Server(url=f"{server_base_url}/admin", username=user, password=pswd,
                           expiration=2880, initialize=True)
# get geocoding service
geocoder_na_service = gis_server.content.get("NorthAmerica")
# init geocoder object from geocoder service
geocoder_na = Geocoder(geocoder_na_service)
# batch geocode
result = batch_geocode(addresses=["380 new york st, redlands, ca"], 
                       category="Street Address", out_sr=4326, geocoder=geocoder_na, 
                       as_featureset=True, match_out_of_range=True, location_type='street' )
print(result)

error:

AttributeError: 'Geocoder' object has no attribute 'find'

Screenshots If applicable, add screenshots to help explain your problem. image

Expected behavior Was expecting a result featureset

Platform (please complete the following information):

achapkowski commented 1 year ago

@anandak does your geocoding service support batch geocoding?

anandak commented 1 year ago

@achapkowski yes, the geocoding service has support for batch geocoding