Hello,
I'm using example 4 of this help page to go off of: https://pro.arcgis.com/en/pro-app/latest/tool-reference/geocoding/geocode-addresses.htm#
Excuse my ignorance, but I'm not sure what the full URL should be to access the ArcGIS World Geocoding Service. I'm guessing this is just a base URL in the example, so I'm looking for some direction as to what a complete URL would like?
#ArcGIS World Geocoding Service URL
locator = r"https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/ArcGIS World Geocoding Service"
#Locator parameters
fieldMap = ("\'Address or Place\' adcal VISIBLE NONE;Address2 <None> VISIBLE NONE;Address3 <None> VISIBLE NONE;" +
"Neighborhood <None> VISIBLE NONE;City city VISIBLE NONE;County <None> VISIBLE NONE;" +
"State state VISIBLE NONE;ZIP ZIP zip VISIBLE NONE;ZIP4 <None> VISIBLE NONE;" +
"Country <None> VISIBLE NONE")
gcName = "wasteRecyclingReport_geocode"
geocodeResult = os.path.join(out_location, gcName)
arcpy.geocoding.GeocodeAddresses(intable, locator, fieldMap, geocodeResult)
If you run that you get:
---------------------------------------------------------------------------
ExecuteError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_15300/42733642.py in <module>
7 gcName = "wasteRecyclingReport_geocode"
8 geocodeResult = os.path.join(out_location, gcName)
----> 9 arcpy.geocoding.GeocodeAddresses(intable, locator, fieldMap, geocodeResult)
C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geocoding.py in GeocodeAddresses(in_table, address_locator, in_address_fields, out_feature_class, out_relationship_type, country, location_type, category, output_fields)
517 return retval
518 except Exception as e:
--> 519 raise e
520
521 @gptooldoc('PackageLocator_geocoding', None)
C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geocoding.py in GeocodeAddresses(in_table, address_locator, in_address_fields, out_feature_class, out_relationship_type, country, location_type, category, output_fields)
514 from arcpy.arcobjects.arcobjectconversion import convertArcObjectToPythonObject
515 try:
--> 516 retval = convertArcObjectToPythonObject(gp.GeocodeAddresses_geocoding(*gp_fixargs((in_table, address_locator, in_address_fields, out_feature_class, out_relationship_type, country, location_type, category, output_fields), True)))
517 return retval
518 except Exception as e:
C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py in <lambda>(*args)
510 val = getattr(self._gp, attr)
511 if callable(val):
--> 512 return lambda *args: val(*gp_fixargs(args, True))
513 else:
514 return convertArcObjectToPythonObject(val)
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000005: Could not open the address locator.
Failed to execute (GeocodeAddresses).