Three text strings geocoded in one transaction with the geocoding service
What is batch geocoding?
Batch geocoding, also known as bulk geocoding, is the process of converting a list of addresses or place names to a set of complete addresses with locations.
Batch geocoding is commonly used to:
- Convert a number of addresses to complete addresses.
- Find the locations for a list of addresses.
- Perform large batches of geocoding.
- Geocode addresses that can be saved for future use.
How batch geocoding works
You can geocode many addresses at once by making an HTTPS request to the geocoding service geocode
operation or by using client APIs. Specify the addresses, and optionally, additional parameters to refine the output.
The more complete you can make the input addresses, the more likely the geocoding service find an exact match for them. For example, "1600 Pennsylvania Ave NW, Washington, District of Columbia, 20500".
To keep track of each input and output address, the input values should contain an objectid field to connect the input data record to the output address candidate returned (see ResultID).
To refine the geocoded address output, provide additional parameters such as the search extent, location type, category, and source country.
The geocoding service parses each address and uses all of the parameters to return a set of geocoded address locations. Each location contains a full address, location, attributes, and a score of how well it matched.
URL request
https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?<parameters>
Learn more about standard and enhanced endpoints in Service endpoints.
Required parameters
Name | Description | Examples |
---|---|---|
f | The format of the data returned. | f=json f=pjson |
token | An access token (API key or OAuth 2.0) with the required premium privilege. | token= |
Key parameters
Name | Description | Examples |
---|---|---|
addresses | A JSON object with an address or place name. Different address formats are supported. | See example |
Additional parameters: Refine the search results by using parameters such as search
, location
, category
, country
. Use lang
to return results in a specific language.
Code examples
Geocode a set of addresses
Use the geocoding service to find the location of many addresses.
Steps
-
Reference the geocoding service.
-
Set the addresses to be geocoded. All input addresses should include an
objectid
. -
Set the
token
parameter to your API key.
The response contains a set of geocoded addresses. The input objectid
matches the output Result
for each record. Addr
represents whether the input address resolved to a standard address or POI. score
represents how well it matched.
Use the geocoding service to find the location of many addresses.
APIs
const geocodingServiceUrl =
"http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"
const params = {
addresses: [
{
objectid: 1,
address: "Buckingham Palace",
},
{
objectid: 2,
address: "Abeno Restaurant London",
},
{
objectid: 3,
address: "58 Brewer Street, London, England",
},
],
}
locator.addressesToLocations(geocodingServiceUrl, params).then(
results => {
if (results.length) {
results.forEach(result => {
addGraphic(result)
})
}
},
function(error) {
console.log(error)
}
)
REST API
curl https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses \
-d 'f=pjson' \
-d 'addresses=
{
"records": [
{
"attributes": {
"objectid": 1,
"address": "Buckingham Palace"
}
},
{
"attributes": {
"objectid": 2,
"address": "Bernardis Restaurant London"
}
},
{
"attributes": {
"objectid": 3,
"address": "58 Brewer Street, London, England"
}
}
]
}' \
-d 'token=<ACCESS_TOKEN>'