Batch geocoding

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 geocodeAddresses 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>

Key parameters

NameDescriptionExamples
addressesA 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 searchExtent, locationType, category, countryCode. Use langCode to return results in a specific language.

Examples

Geocode a set of addresses

Use the geocoding service to find the location of many addresses.

Steps

  1. Reference the geocoding service.

  2. Set the addresses to be geocoded. All input addresses should include an objectid.

  3. Set the token parameter to your API key.

The response contains a set of geocoded addresses. The input objectid matches the output ResultID for each record. Addr_type represents whether the input address resolved to a standard address or POI. score represents how well it matched.

APIs

ArcGIS JS APIEsri LeafletMapbox GL JSOpenLayersArcGIS REST JS
                                                                                                                                
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
  <title>ArcGIS Developer Guide: Batch geocoding</title>
     <!-- ArcGIS Mapping APIs and Location Services Developer Guide
    Learn more: https://developers.arcgis.com/documentation/mapping-apis-and-location-services/search/
    -->
  <style>
    html, body, #viewDiv {
      padding: 0;
      margin: 0;
      height: 100%;
      width: 100%;
    }
    .panel {
      display: grid;
      padding: 0px 10px 10px;
      width:  300px;
    }
    .addresses {
      overflow: scroll;
    }
  </style>

  <link rel="stylesheet" href="https://js.arcgis.com/4.18/esri/themes/light/main.css">
  <script src="https://js.arcgis.com/4.18/"></script>

  <script>
    require([
      "esri/config",
      "esri/Map",
      "esri/views/MapView",
      "esri/tasks/Locator",
      "esri/Graphic"
    ], function (esriConfig, Map, MapView, Locator, Graphic) {

      esriConfig.apiKey = "YOUR-API-KEY";

      const map = new Map({
        basemap: "arcgis-light-gray", //Basemap layer service
      });

      const view = new MapView({
        container: "viewDiv",
        map: map,
        center: [-0.1278, 51.5074],
        zoom: 12,
        constraints: {
          snapToZoom: false
        }
      });

      const records = `1. Buckingham Palace<br/>2. Abeno Restaurant London<br/>3. 58 Brewer Street, London, England`;

      view.when(() => {

        const locator = new Locator({
          url: "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(params).then(
          (results) => {
            if (results.length) {
              results.forEach((result) =>  {
                addGraphic(result);
              });
            }
          },
          function (error) {
            console.log(error);
          });

      });

      //Show results
      function addGraphic(result) {
        const markerSymbol = {
          type: "simple-marker",
          outline: {
            color: "white",
            width: 1.5
          },
          color: "black",
          size: "10px"
        };
        const graphic = new Graphic({
          geometry: result.location,
          symbol: markerSymbol,
          attributes: result.attributes,
          popupTemplate: {
            title: "Address #" + result.attributes.ResultID,
            content:
              result.attributes.LongLabel +
              "<br>" +
              result.attributes.Type +
              "<br><br>" +
              result.location.x.toFixed(5) +
              ", " +
              result.location.y.toFixed(5),
          },
        });
        view.graphics.add(graphic);
      }
    });
  </script>
</head>
<body>
  <div id="viewDiv"></div>
</body>
</html>

REST API

RequestResponse
                          
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=YOUR-API-KEY'

Response (JSON)

                                                                                                                                                                                                                    
{
  "spatialReference": {
    "wkid": 4326,
    "latestWkid": 4326
  },
  "locations": [
    {
      "address": "Buckingham Palace",
      "location": {
        "x": -0.14113000099996498,
        "y": 51.501639976000035
      },
      "score": 100,
      "attributes": {
        "ResultID": 1,
        "Loc_name": "World",
        "Status": "T",
        "Score": 100,
        "Match_addr": "Buckingham Palace",
        "LongLabel": "Buckingham Palace, London, England, SW1A 1, GBR",
        "ShortLabel": "Buckingham Palace",
        "Addr_type": "POI",
        "Type": "Historical Monument",
        "PlaceName": "Buckingham Palace",
        "Place_addr": "London, England, SW1A 1",
        "Phone": "",
        "URL": "",
        "Rank": 2.5,
        "AddBldg": "",
        "AddNum": "",
        "AddNumFrom": "",
        "AddNumTo": "",
        "AddRange": "",
        "Side": "",
        "StPreDir": "",
        "StPreType": "",
        "StName": "",
        "StType": "",
        "StDir": "",
        "BldgType": "",
        "BldgName": "",
        "LevelType": "",
        "LevelName": "",
        "UnitType": "",
        "UnitName": "",
        "SubAddr": "",
        "StAddr": "",
        "Block": "",
        "Sector": "",
        "Nbrhd": "",
        "District": "",
        "City": "London",
        "MetroArea": "",
        "Subregion": "London",
        "Region": "England",
        "RegionAbbr": "ENG",
        "Territory": "",
        "Zone": "St James's",
        "Postal": "SW1A 1",
        "PostalExt": "",
        "Country": "GBR",
        "LangCode": "ENG",
        "Distance": 0,
        "X": -0.14113000129708159,
        "Y": 51.501639976052296,
        "DisplayX": -0.14309999999994716,
        "DisplayY": 51.500810000000058,
        "Xmin": -0.14809999999994716,
        "Xmax": -0.13809999999994715,
        "Ymin": 51.495810000000056,
        "Ymax": 51.505810000000061,
        "ExInfo": ""
      }
    },
    {
      "address": "58 Brewer Street, London, England, W1F 9",
      "location": {
        "x": -0.13598567199994704,
        "y": 51.511329911000075
      },
      "score": 100,
      "attributes": {
        "ResultID": 3,
        "Loc_name": "World",
        "Status": "M",
        "Score": 100,
        "Match_addr": "58 Brewer Street, London, England, W1F 9",
        "LongLabel": "58 Brewer Street, London, England, W1F 9, GBR",
        "ShortLabel": "58 Brewer Street",
        "Addr_type": "PointAddress",
        "Type": "",
        "PlaceName": "",
        "Place_addr": "58 Brewer Street, London, England, W1F 9",
        "Phone": "",
        "URL": "",
        "Rank": 20,
        "AddBldg": "",
        "AddNum": "58",
        "AddNumFrom": "",
        "AddNumTo": "",
        "AddRange": "",
        "Side": "L",
        "StPreDir": "",
        "StPreType": "",
        "StName": "Brewer",
        "StType": "Street",
        "StDir": "",
        "BldgType": "",
        "BldgName": "",
        "LevelType": "",
        "LevelName": "",
        "UnitType": "",
        "UnitName": "",
        "SubAddr": "",
        "StAddr": "58 Brewer Street",
        "Block": "",
        "Sector": "",
        "Nbrhd": "",
        "District": "",
        "City": "London",
        "MetroArea": "",
        "Subregion": "London",
        "Region": "England",
        "RegionAbbr": "ENG",
        "Territory": "",
        "Zone": "Soho",
        "Postal": "W1F 9",
        "PostalExt": "TL",
        "Country": "GBR",
        "LangCode": "ENG",
        "Distance": 0,
        "X": -0.13598567222568081,
        "Y": 51.511329911189328,
        "DisplayX": -0.13607099999998695,
        "DisplayY": 51.511374000000018,
        "Xmin": -0.13707099999998695,
        "Xmax": -0.13507099999998695,
        "Ymin": 51.51037400000002,
        "Ymax": 51.512374000000015,
        "ExInfo": ""
      }
    },
    {
      "address": "Bernardi's",
      "location": {
        "x": -0.16116999999997006,
        "y": 51.514300000000048
      },
      "score": 100,
      "attributes": {
        "ResultID": 2,
        "Loc_name": "World",
        "Status": "M",
        "Score": 100,
        "Match_addr": "Bernardi's",
        "LongLabel": "Bernardi's, Seymour Street, London, England, W1H 7, GBR",
        "ShortLabel": "Bernardi's",
        "Addr_type": "POI",
        "Type": "Italian Food",
        "PlaceName": "Bernardi's",
        "Place_addr": "Seymour Street, London, England, W1H 7",
        "Phone": "+44 20-38267940",
        "URL": "http://bernardis.co.uk/",
        "Rank": 19,
        "AddBldg": "",
        "AddNum": "",
        "AddNumFrom": "",
        "AddNumTo": "",
        "AddRange": "",
        "Side": "",
        "StPreDir": "",
        "StPreType": "",
        "StName": "Seymour",
        "StType": "Street",
        "StDir": "",
        "BldgType": "",
        "BldgName": "",
        "LevelType": "",
        "LevelName": "",
        "UnitType": "",
        "UnitName": "",
        "SubAddr": "",
        "StAddr": "Seymour Street",
        "Block": "",
        "Sector": "",
        "Nbrhd": "",
        "District": "",
        "City": "London",
        "MetroArea": "",
        "Subregion": "London",
        "Region": "England",
        "RegionAbbr": "ENG",
        "Territory": "",
        "Zone": "Marylebone",
        "Postal": "W1H 7",
        "PostalExt": "",
        "Country": "GBR",
        "LangCode": "ENG",
        "Distance": 0,
        "X": -0.16116999999997006,
        "Y": 51.514300000000048,
        "DisplayX": -0.16116999999997006,
        "DisplayY": 51.514300000000048,
        "Xmin": -0.16616999999997006,
        "Xmax": -0.15616999999997005,
        "Ymin": 51.509300000000046,
        "Ymax": 51.519300000000051,
        "ExInfo": ""
      }
    }
  ]
}

Tutorials

Services

Geocoding service

Search for addresses, businesses, and places around the world.

API support

GeocodingReverse GeocodingBatch GeocodingPlace/POI SearchAutosuggestUI Component
ArcGIS API for JavaScriptFully supportedFully supportedFully supportedFully supportedFully supportedFully supported
ArcGIS API for AndroidFully supportedFully supportedFully supportedFully supportedFully supportedNot supported
ArcGIS API for iOSFully supportedFully supportedFully supportedFully supportedFully supportedNot supported
ArcGIS API for .NetFully supportedFully supportedFully supportedFully supportedFully supportedNot supported
ArcGIS API for QtFully supportedFully supportedFully supportedFully supportedFully supportedNot supported
ArcGIS API for JavaFully supportedFully supportedFully supportedFully supportedFully supportedNot supported
ArcGIS API for PythonFully supportedFully supportedFully supportedFully supportedFully supportedNot supported
Esri LeafletFully supportedFully supportedAccess via ArcGIS REST JSFully supportedFully supportedFully supported
MapBox GL JSAccess via ArcGIS REST JSAccess via ArcGIS REST JSAccess via ArcGIS REST JSAccess via ArcGIS REST JSAccess via ArcGIS REST JSNot supported
OpenLayersAccess via ArcGIS REST JSAccess via ArcGIS REST JSAccess via ArcGIS REST JSAccess via ArcGIS REST JSAccess via ArcGIS REST JSNot supported
ArcGIS REST JSFully supportedFully supportedFully supportedFully supportedFully supportedNot supported
Full supportPartial support (see notes)Not supported

Tools