Skip To Content ArcGIS for Developers Sign In Dashboard

Geocode File

The GeocodeFile task geocodes a zipped table or file of addresses and returns the geocoded results. It supports zipped CSV and XLS files and geodatabase table input. The task geocodes the entire file regardless of its size.

Request URL

https://<analysis url>/GeocodeFile/submitJob

Request parameters

ParameterDescription

geocodeParameters (Required)

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 and adjust it accordingly before submitting your job, otherwise your geocoding results may not be accurate. It is recommended that you use the output from AnalyzeGeocodeInput, and modify the field mapping instead of constructing this JSON by hand and passing it in.

Values

  • field_info—A list of triples with the field names of your input file/table, its field type (usually TEXT), and its allowed length (usually 255). A sample input looks like [['ObjectID', 'TEXT', 255], ['Address', 'TEXT', 255], ['Region', 'TEXT', 255], ['Postal', 'TEXT', 255]]
  • column_names—Submit the column names of your data if your data does not have a header row.
  • file_type—Either csv, xlsx, or gdb
  • column_delimiter—";", "\t", "|", or ","
  • text_qualifier—Either "\"" or "\'"
  • field_mapping—Field mapping between each input field and candidate fields on the geocoding service, for example,[['ObjectID', 'OBJECTID'], ['Address', 'Address'], ['Region', 'Region'], ['Postal', 'Postal']]
  • header_row_exists—Enter true or false.

Example: {"field_info": "[['ObjectID', 'TEXT', 255], ['SingleLine', 'TEXT', 255], ['Address', 'TEXT', 255], ['Region', 'TEXT', 255], ['Postal', 'TEXT', 255], ['PostalExt', 'TEXT', 255], ['Country', 'TEXT', 255], ['Source', 'TEXT', 255]]", "column_names": "", "file_type": "gdb", "column_delimiter": ",", "text_qualifier": "", "field_mapping": "[['ObjectID', 'OBJECTID'], ['SingleLine', 'SingleLine'], ['Address', 'Address'], ['Region', 'Region'], ['Postal', 'Postal'], ['PostalExt', 'PostalExt'], ['Country', ''], ['Source', '']]", "header_row_exists": true}

geocodeServiceURL

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 can be a utility service or a geocoder that is anonymously accessible. The geocoding service must be configured to allow batch geocoding. For more information, see Configuring batch geocoding

outputType

Enter the format of the expected geocoding results.

Values: csv | xls | gdb

inputFile

The input file must be a zipped CSV file, XLSX file, or a zipped file geodatabase table. The file must already be uploaded to ArcGIS Server.

Example: {"itemID":"<itemid_of_file>"}

tableName

Enter a table name if your input is an XLSX file or a file geodatabase table. If your input is a zipped XLSX file, enter the name of the sheet in tableName. If your input is a zipped file geodatabase table, enter the name of the table in the file geodatabase that you want to geocode.

Example: Sheet1

sourceCountry

Enter a sourceCountry if all of your data is from the same country.

Example: US

category

Enter a category for more precise geocoding results if applicable. Note that some geocoding services do not support category.

Example: POI

outputFields

Enter the output fields from the geocoding service that you want returned in the results, separated by commas. To output all available outputFields, leave this parameter blank.

Example: score,match_addr,x,y

headerRowsToSkip

Describes the row on which your data begins in your file or table. The default is 1 (since the first row contains the headers).

The default is 1.

Example: 1

outputName

If provided, the task will create a feature service of the results. You define the name of the service. If outputName is not supplied, the task will return a feature collection.

Syntax:
{
  "serviceProperties": {
    "name": "<service name>"
  }
}

context

Contains additional settings that affect task execution. Batch Geocode has the following two settings:

  • Extent (extent)—A bounding box that defines the analysis area. Only those points in inputLayer that intersect the bounding box are analyzed.
  • Output Spatial Reference (outSR)—The output features are projected into the output spatial reference.

Syntax:
{
"extent" : {extent},
"outSR" : {spatial reference}
}

locatorParameters

A JSON input that can include keys such as locationType, sourceCountry, or categroy. This JSON is another way to pass different parameters for geocoding. Possible values for locationType are rooftop and street.

Syntax:
{
"locationType" : "rooftop"
}

f

The response format. The default response format is html.

Values: html | json

Response

When you submit a request, the service assigns a unique job ID for the transaction.

Syntax:
{
"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:

https://<analysis url>/GeocodeFile/jobs/<jobId>

Access results

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>/GeocodeFile/jobs/<jobId>/results/<output parameter name>?token=<your token>&f=json

ParameterDescription

geocodeResult

geocodeResult can be a zipped CSV file, XLS file, or file geodatabase with the geocoded results.

The result has properties for parameter name, data type, and value.

The value contains the URL to download the zipped geocoding results.

{
 "paramName": "geocodeResult",
 "dataType": "GPDataFile",
 "value": {
  "url": "https://<server name>/server/rest/directories/arcgisjobs/
utilities/geocodingtools_gpserver/jde7cfd2836904c6bb7744f627e2ca1ad/scratch/output.zip"
 }
}