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. These fields are listed in the addressFields property of the JSON representation associated geocode service resource. 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.

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

Syntax:

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

Example 1:

{       
    "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.

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"
   }
  }
 ]
}