Skip to main content

Geocoding Batch

Batch geocoding 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.

POST /locations/address/batch

Resource URL

https://pcmiler.alk.com/apis/rest/v1.0/service.svc/locations/address/batch

Request Body

The request body consists of a JSON-formatted Locations object with series of addresses to be geocoded.

Element Definition Required
Region Sets 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.
MaxResults Indicate the maximum number of results to be returned from a search. By default is null, which indicates that all results are wanted. N
CitySearchFilter For filtering results with pure city searches when GeoList is true. Possible values are the default of 0 (CitiesWithZips), or 1 (CityCentersOnly). N
Address An Address object. Gets or sets the address that needs to be geocoded. Usage: Address = new Address() { Zip = “08540” }. Y
Address.CountryPostalFilter For 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.AbbreviationFormat For 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
GeoList A 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
  }
]
Last updated April 16, 2024.
API Endpoint: