The Batch Geocode task geocodes a table or file of addresses and returns the geocoded results. It supports CSV, XLS or table input. The task geocodes the entire file regardless of size.
Note:This method only exists in ArcGIS Enterprise. This API is not supported for ArcGIS Online.
This includes parameters that help parse the file, as well the field lengths and a field mapping. This JSON is the output from AnalyzeGeocodeInput. It is important to inspect the field mapping closely and adjust it accordingly before submitting your job, otherwise your geocoding results may not be accurate. It is recommended to use the output from AnalyzeGeocodeInput and modify the field mapping instead of constructing this JSON by hand and passing it in.
Enter the REST URL of the geocode service that you want to geocode your addresses against. The URL must end in geocodeServer and allow batch requests. This could be a utility service, locator item on the portal, or a locator that is anonymously accessible. The geocode service must be configured to allow for batch geocoding. For more information, see: Configuring batch geocoding
Specifies the output type format the expected geocode results are returned in.
Values: csv | xls | Feature Collection | Feature Service
The input table specification must include the following:
If the table is a hosted table on the same portal, serviceToken is not required.
The input file with the addresses and places to geocode should be a portal item. Input the itemid of the item in the portal. The format of the item in the portal can be one of the following:
This parameter will limit geocoding to the country or countries specified. Specifying the country where the addresses or places are from in the inputFileItem or inputTable will improve the accuracy of geocoding in most cases. If a field representing countries in the inputFileItem or inputTable is mapped to the input Country field from the geocode service in field_mapping, the country value from the inputFileItem or inputTable will override the sourceCountry parameter.
This is limited to the specified country or countries, and when no sourceCountry is specified, geocoding is performed against all supported countries of the locator. You can specify the input value as either two-character or three-character country codes in a comma-separated list. See the Supported Country Codes column for the input value to use.
Not all geocode services support sourceCountry.
Limits the types of places the geocode service searches, which eliminates false positive matches and potentially speeds up the search process. When no category is used, geocoding is performed against all supported categories. In general, you can use the parameter for the following:
Not all geocode services support category.
See the ArcGIS REST API web help for details about category filtering.
Parameter options are the following:
Describes on which row your data begins in your file or table. The default is 1 (since the first row contains the headers). The default is 1.
If provided, the task will create a feature service of the results. You define the name of the service. If an outputName value is not provided, the task will return a feature collection. Syntax: Syntax:
The Context parameter contains the following additional settings that affect task operation:
This parameter takes a dictionary that can contain any or all of the following optional geocoding parameters:
The response format. The default response format is html.
Values: html | json
When you submit a request, the service assigns a unique job ID for the transaction.
"jobId": "<unique job identifier>",
"jobStatus": "<job status>"
After the initial request is submitted, you can use jobId to periodically check the status of the job and messages as described in Checking job status. Once the job has successfully completed, use jobId to retrieve the results. To track the status, you can make a request in the following form:
When the status of the job request is esriJobSucceded, you can access the results of the analysis by making a request in the following form:
https://<analysis-url>/BatchGeocode/jobs/<jobId>/results/<output parameter name>?token=<your token>&f=json
geocodeResult can be a feature collection JSON, or it contains the itemId of the geocoding job. itemId is either a feature service or a file, depending on the desired outputType.
The result has properties for parameter name, data type, and value. The contents of value depend on the outputName parameter provided in the initial request.
If outputName was provided, value contains the URL to the feature service layer:
If outputName was not provided, value contains a feature collection:
See Feature Output for more information about how the result layer or collection is accessed.
geocodingStatistics output JSON includes statistics about the batch geocoding job. The result has properties for parameter name, data type, and value. The value contains the JSON of percentages for matched, unmatched, and tied records in the batch geocoding job. It may also contain "Dropped Records", an additional list of ObjectIDs for the records that were unable to be processed.