Hello everyone,
Looking to create a geo-processing service to check (geocode) a Single Address entered as parameter, then the next step is an intersect to check if the address (point) falls inside a specific service area. The code will be in Python
Any sample code available for geocoding an address passed as parameter?
Thanks
Hi Jose, here is an example of how you could do the geocoding if you want to use ESRI's Geocoder which uses credits. You start by creating a string parameter in a script tool paired with the following code. Once you have the geocoding result point (geocodedAddress), you can program your service area check.
import arcpy
addressToGeocode = arcpy.GetParameterAsText(0)
arcpy.management.CreateTable(arcpy.env.scratchWorkspace, "AddressTable")
arcpy.management.AddField("AddressTable", "Address", "TEXT")
with arcpy.da.InsertCursor('AddressTable', ["Address"]) as icursor:
icursor.insertRow([addressToGeocode])
field_map = "Address Address"
locator = "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/ArcGIS World Geocoding Service"
arcpy.geocoding.GeocodeAddresses("AddressTable", locator, field_map, "geocodedAddress")