Geocoding Batch

Batch geocoding on the /locations/address/batch resource allows you to retrieve longitude and latitude coordinates as well as address information for a set of addresses through a single POST request. (For example, if you want to geocode hundreds of locations at once to plan a fleet’s routes for the day.)

The request body contains a collection of addresses to geocode. The response returns a list of geocoded output locations in JSON format.

If the geocoding service finds multiple results that match the address object, the best match is returned by default. To receive multiple results set the optional GeoList property to true within the desired location object.

Request URL

POST https://pcmiler.alk.com/apis/rest/v1.0/Service.svc/locations/address/batch?dataset={dataset}

Request Body

The request body consists of a JSON formatted GeocodeRequestBody object.

ElementDefinitionRequired
RegionSets the region where the address is located. Possible values are 0 (Unknown) with incrementing numerical values for AF, AS, EU, NA, OC, SA, and ME. NA is the default.Y, if geocoding locations outside of North America.
MaxResultsIndicate the maximum number of results to be returned from a search. By default is null, which indicates that all results are wanted.N
CitySearchFilterFor filtering results with pure city searches when GeoList is true. Possible values are the default of 0 (CitiesWithZips), or 1 (CityCentersOnly).N
AddressAn Address object. Gets or sets the address that needs to be geocoded. Usage: Address = new Address() { Zip = “08540” }.Y
Address.CountryPostalFilterFor restricting results in cases when a zip code might be in Mexico and the US. Possible values are the default of 0 (US), or 1 (Mexico) or 2 (Both).N
Address.AbbreviationFormatFor specifying the abbreviation format of the country in the State field when outside of NA. Possible values are default of 0 (FIPS), 1 (ISO2), 2 (ISO3), 3 (GENC2) and and 4 (GENC3). See table in Glossary.N
GeoListA Boolean value. Gets or sets a value indicating whether to return a single match for the geocoded result or multiple matches (if they exist). Usage: GeoList = true.N

Sample JSON POST Body

{
  "Locations": [
    {
      "Address": {
        "StreetAddress": "1000 Herrontown Rd",
        "City": "Princeton",
        "State": "NJ",
        "Zip": "",
        "County": "",
        "Country": null,
        "SPLC": "",
        "CountryPostalFilter": 0,
        "AbbreviationFormat": 0,
        "CountryAbbreviation": "US"
      },
      "Region": 4,
      "GeoList": false,
      "MaxResults": null,
      "CitySearchFilter": 0
    },
    {
      "Address": {
        "StreetAddress": "457 N Harrison St",
        "City": "",
        "State": "",
        "Zip": "08540",
        "County": "",
        "Country": null,
        "SPLC": "",
        "CountryPostalFilter": 0,
        "AbbreviationFormat": 0
      },
      "Region": 4,
      "GeoList": false,
      "MaxResults": null,
      "CitySearchFilter": 0
    },
    {
      "Address": {
        "StreetAddress": "1 Independence Way",
        "City": "Princeton",
        "State": "",
        "Zip": "08540",
        "County": "",
        "Country": null,
        "SPLC": "",
        "CountryPostalFilter": 0,
        "AbbreviationFormat": 0
      },
      "Region": 4,
      "GeoList": false,
      "MaxResults": null,
      "CitySearchFilter": 0
    }
  ]
}

Sample Response

[
  {
    "Address": {
      "StreetAddress": "1000 Herrontown Road",
      "City": "Princeton",
      "State": "NJ",
      "Zip": "08540",
      "County": "Mercer",
      "Country": "United States",
      "SPLC": null,
      "CountryPostalFilter": 0,
      "AbbreviationFormat": 0
    },
    "Coords": {
      "Lat": "40.388440",
      "Lon": "-74.655071"
    },
    "Region": 4,
    "Label": "",
    "PlaceName": "",
    "TimeZone": "EST",
    "Errors": [],
    "SpeedLimitInfo": null,
    "ConfidenceLevel": "Exact",
    "DistanceFromRoad": null,
    "CrossStreet": null
  },
  {
    "Address": {
      "StreetAddress": "457 North Harrison Street",
      "City": "Princeton",
      "State": "NJ",
      "Zip": "08540",
      "County": "Mercer",
      "Country": "United States",
      "SPLC": null,
      "CountryPostalFilter": 0,
      "AbbreviationFormat": 0
    },
    "Coords": {
      "Lat": "40.367274",
      "Lon": "-74.655365"
    },
    "Region": 4,
    "Label": "",
    "PlaceName": "",
    "TimeZone": "EST",
    "Errors": [],
    "SpeedLimitInfo": null,
    "ConfidenceLevel": "Exact",
    "DistanceFromRoad": null,
    "CrossStreet": null
  },
  {
    "Address": {
      "StreetAddress": "1 Independence Way",
      "City": "Princeton",
      "State": "NJ",
      "Zip": "08540",
      "County": "Mercer",
      "Country": "United States",
      "SPLC": null,
      "CountryPostalFilter": 0,
      "AbbreviationFormat": 0
    },
    "Coords": {
      "Lat": "40.360399",
      "Lon": "-74.599270"
    },
    "Region": 4,
    "Label": "",
    "PlaceName": "",
    "TimeZone": "EST",
    "Errors": [],
    "SpeedLimitInfo": null,
    "ConfidenceLevel": "Exact",
    "DistanceFromRoad": null,
    "CrossStreet": null
  }
]