Geocode Addresses

Description

This operation was added at 10.1.

The geocodeAddresses operation is performed on a Geocode Service resource. The result of this operation is a resource representing the list of geocoded addresses. This resource provides information about the addresses including the address, location, score, and other geocode service-specific attributes.

You can provide arguments to the geocodeAddresses operation as query parameters defined in the following parameters table.

Request parameters

Parameter

Details

f

Description: The response format. The default response format is html.

Values: html | json | kmz

addresses

Description: A record set representing the addresses to be geocoded. Each record must include an OBJECTID attribute with a unique value, as well as various address fields accepted by the corresponding geocode service. The field names that should be used can be found in the JSON representation of the geocode service resource under the addressFields property, for multiple input field geocoding, or the singleLineAddressField property, for single input field geocoding. The OBJECTID specified in the request is reflected as ResultID in the response.

The maximum number of addresses that can be geocoded in a single request is limited to the SuggestedBatchSize property of the locator.

Syntax:

{ 
"records"  : [
{
   "attributes" : {"<OBJECTID>" : "<OID11>","<field1>" : "<value11>", "<field2>" : "<value12>", "<field3>" : "<value13>"}
},
{
   "attributes" : {"<OBJECTID>" : "<OID21>","<field1>" : "<value21>", "<field2>" : "<value22>", "<field3>" : "<value23>"}
}
]
}

Example 1: The addressFields of a geocode service resource includes fields with the names Street and Zone. You can provide the input for addresses as follows:

{       
    "records": [
        {
            "attributes": {
                "OBJECTID": 1,
                "STREET": "440 Arguello Blvd",
                "ZONE": "94118"
            }
        },
   {
            "attributes": {
                "OBJECTID": 2,
                "STREET": "450 Arguello Blvd",
                "ZONE": "94118"
            }
        }
    ]
}

Example 2: Using a single line address input, where SINGLELINEINPUT is the name of the singleLineAddressField property of the Geocode Service:

{       "records": [
        {
            "attributes": {
                "OBJECTID": 1,
                "SINGLELINEINPUT": "440 Arguello Blvd, San Francisco, CA 94118"
            }
        },
   {
            "attributes": {
                "OBJECTID": 2,
                "SINGLELINEINPUT": "450 Arguello Blvd, San Francisco, CA 94118"
            }
        }
    ]
}

outSR

Description: The well-known ID of the spatial reference, or a spatial reference json object for the returned addresses. For a list of valid WKID values, see Projected coordinate systems and Geographic coordinate systems.

sourceCountry

Description: The sourceCountry parameter is only supported by geocode services published using StreetMap Premium locators.

Added at 10.3 and only supported by geocode services published with ArcGIS 10.3 for Server and later versions.

category

The category parameter is only supported by geocode services published using StreetMap Premium locators.

Added at 10.3 and only supported by geocode services published with ArcGIS 10.3 for Server and later versions.

Example usage

Batch geocode a list of addresses:

http://myserver/arcgis/rest/services/SFOStreets/GeocodeServer/geocodeAddresses?addresses={"records":[{"attributes":{"OBJECTID":1,"STREET":"440 Arguello Blvd","ZONE":"94118"}},{"attributes":{"OBJECTID":2,"STREET":"450 Arguello Blvd","ZONE":"94118"}}]}&outSR=&f=pjson

JSON response syntax

{"spatialReference" : <spatialReference>,"locations" : [  {  "address" : "<address1>",  "location" : { <point1> },  "score" : <score1>,  "attributes" : {<fieldName1> : <value11>, <fieldName2> : <value12>}  },  {  "address" : "<address2>",  "location" : { <point2> },  "score" : <score2>,  "attributes" : {<fieldName1> : <value21>, <fieldName2> : <value22>}  } 	]}

JSON response example

{
 "spatialReference": {
  "wkid": 4269,
  "latestWkid": 4269
 },
 "locations": [
  {
   "address": "440 ARGUELLO BLVD, 94118",
   "location": {
    "x": -122.45887187536766,
    "y": 37.782653319533836
   },
   "score": 94,
   "attributes": {
    "ResultID": 1,
    "Status": "M",
    "Score": 94,
    "Side": "L",
    "Match_addr": "440 ARGUELLO BLVD, 94118"
   }
  },
  {
   "address": "450 ARGUELLO BLVD, 94118",
   "location": {
    "x": -122.45885341927038,
    "y": 37.782436661000418
   },
   "score": 94,
   "attributes": {
    "ResultID": 2,
    "Status": "M",
    "Score": 94,
    "Side": "L",
    "Match_addr": "450 ARGUELLO BLVD, 94118"
   }
  }
 ]
}

7/5/2017