The /geocode request converts a list of addresses or place names to a set of complete addresses with locations. The list of addresses can be formatted as a JSON structure or provided in a CSV file.
This operation can be used to find the following types of locations:
-
Street addresses
27488 Stanford Ave, Bowden, North Dakota380 New York St, Redlands, CA 92373
-
Administrative place-names, such as city, county, state, province, or country names
Seattle, WashingtonState of MahārāshtraLiechtenstein
-
Postal codes
92591TW9 1 DN
-
Points of interest (POI) by name
Disneyland, Californiastarbucks, 5th Ave, San Diegomount everest
-
Coordinates
-117.155579,32.703761
The addresses in your table can be stored in a single field or in multiple fields—one for each address component. Batch geocoding performance is better when the address parts are stored in separate fields.
Use the batchGeocode operation to geocode a CSV (comma-separated values) file of addresses. The capabilities of batch are the same as the geocode operation. These are the primary differences—
- With
batch, the input addresses are passed to the service in a file; withGeocode geocode, the addresses are passed to the service as a collection of JSON objects.Addresses - The
batchprocess is executed as a job whose status can be monitored, and it does not block, nor is blocked by, other geocoding operations running concurrently.Geocode
The batch workflow is recommended for geocoding scenarios where a very large number of addresses need to be geocoded.
You can also batch geocode address tables using the ArcGIS Online Generate and Publish operations. These are higher-level APIs that simplify the batch geocoding process.
To successfully geocode addresses, at least one of the following must be included in the request:
- One or more administrative zones (smaller than country), such as a city name or postal code.
In this context, an address refers to one of the following match address types: Subaddress, PointAddress, StreetAddress, StreetInt, DistanceMarker, StreetMidBlock, StreetBetween, or StreetName.
Parameters
| Name | Required | Type | Default | Description |
|---|---|---|---|---|
f | string | The request response format, either | ||
token | string | An access token with the required privileges. | ||
addresses | object | A record set representing the addresses to be geocoded. | ||
category | string | A place or address type that can be used to filter results. | ||
sourceCountry | string | Sets the country to be geocoded. | ||
outSr | number |
| The spatial reference of the | |
matchOutOfRange | boolean |
| Returns a match when the input house number is outside the street's house number range. | |
locationType | string |
| Specifies whether output geometry of | |
searchExtent | string | envelope | The set of bounding box coordinates that limits the search area. | ||
langCode | string | The language in which results are returned. | ||
preferredLabelValues | string | Returns the specified street or city name in output fields. | ||
outFields | string | * | The list of fields to be returned within the | ||
comprehensiveZoneMatch | boolean |
| Specifies if adjacent administrative zones or postal codes should be disregarded when geocoding an address. |
Required parameters
token
An access token with the required privileges.
- ArcGIS Location Platform: premium:user:geocode:temporary or premium:user:geocode:stored
- ArcGIS Online: premium:user:geocode or premium:user:geocode:stored
token=<ACCESS_TOKEN>To use HTTP headers instead of the token parameter, set the following:
GET <SERVICE_REQUEST> HTTP/1.1
Host: <SERVICE_DOMAIN>
X-Esri-Authorization: Bearer <ACCESS_TOKEN>Learn more about access tokens and privileges in the Security and authentication developer guide.
addresses
A record set representing the addresses to be geocoded. Each record must include an OBJECTID attribute with a unique value as well as values for the address fields supported by the service.
For passing in the location name as a single line of text—single field batch geocoding—use the Single input field.
For passing in the location name as multiple lines of text—multifield batch geocoding—use the address fields described in findAddressCandidates.
The service info page https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer?f=pjson provides localized versions of the input field names in all locales supported by the service. See Localized input field names for more information.
The service info page also provides the maximum length of strings supported for each address input field. For the Single input field, refer to the length attribute of the single object in the service info page. Currently, the maximum length is 200 characters. For the multifield address input fields, such as address , address2 , address3 , city , postal , and so on, refer to the address object. Within this object, each multifield input field is described by a name attribute as well as a corresponding length attribute. The name attribute value in the service info is the same as the input field name. For example, information about the address field can be found by searching for name = address within the address object.
Maximum addresses
There is a limit to the maximum number of addresses that can be geocoded in a single batch request with the service. The Max property defines this limit. For instance, if Max , and a record set sent to the service contains 3,000 addresses, only the first 2,000 will be geocoded. The Suggested property is also useful, as it specifies the optimal number of addresses to include in a single batch request.
Both of these properties can be determined by querying the service description at https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer?f=pjson.
The client application must account for the limit by dividing the input address table into record sets of Max or fewer addresses and send each record set to the service as a separate request. Note that the Generate and Publish operations take care of this for you.
Batch size
For batch geocode operations, the service only returns a response after each address in the input record set has been geocoded. If an unhandled error such as a time-out occurs during the process, the server will not return any results for that request, even if most of the addresses in the input record set have already been geocoded. For this reason, the client application should implement logic to detect and handle such errors.
Response time-outs tend to occur when input addresses are poorly formed or include many extraneous tokens that are not likely to be matched to real address components. The frequency of lost batches due to such time-outs can be mitigated by reducing the number of addresses included in each batch. Follow these general guidelines when choosing a batch size for your operation:
-
If the addresses you want to geocode are poorly formatted, ambiguous, or include many tokens, decrease the batch size to reduce the likelihood of time-outs. For extreme cases, you may need to set the batch size as low as 10 addresses. Be aware that using smaller batches will cause the
geocodeoperation to perform more slowly overall.Addresses -
If the addresses you want to geocode are well-formatted and unambiguous, increase the batch size to improve overall performance. For example, a batch size of 1,000 will result in better performance than smaller batch sizes in this scenario.
Ambiguous addresses are those that include little distinguishing information, and for which there may be many potential matches. For example, 100 Main St USA is an ambiguous address. There may be hundreds of places in the United States with the address 100 Main St. Including more details with the address, such as city and postal code, distinguishes it from other similar addresses and reduces the amount of time needed to find a match. For example, 100 Main St, Escondido, C is distinct and will likely only be matched to a single place.
addresses=
{
"records": [
{
"attributes": {
"OBJECTID": 1,
"Address": "380 New York St",
"Neighborhood": "",
"City": "Redlands",
"Subregion": "",
"Region": "CA"
}
},
{
"attributes": {
"OBJECTID": 2,
"Address": "1 World Way",
"Neighborhood": "",
"City": "Los Angeles",
"Subregion": "",
"Region": "CA"
}
}
]
}Optional parameters
category
A place or address type that can be used to filter geocode results. The parameter supports input of single-category values or multiple comma-separated values. See Category filtering for details about the category parameter.
Example of category filtering with a single category
category=AddressExample of category filtering with multiple categories
category=Address,PostalsourceCountry
A value representing the country. When a value is passed for this parameter, all of the addresses in the input table are sent to the specified country to be geocoded. For example, if source is passed with a batch request, it is assumed that all of the addresses in the table are in the United States, so only matching addresses in the U.S. are returned. Using this parameter can increase batch geocoding performance when all addresses are within a single country.
Acceptable values include the three-character country code. You can specify multiple country codes to limit results to more than one country.
A list of supported countries and codes is available in Data coverage.
Example: Single country
sourceCountry=USAExample: Multiple countries
sourceCountry=FRA,DEU,ESPoutSR
The spatial reference of the x,y coordinates returned by a geocode request. This is useful for applications using a map with a spatial reference different than that of the geocode service.
The spatial reference can be specified as either a well-known ID (WKID) or as a JSON spatial reference object. If out is not specified, the spatial reference of the output locations is the same as that of the service. The ArcGIS Geocoding service spatial reference is WGS84 (WKID = 4326).
For a list of valid WKID values, see Projected coordinate systems and Geographic coordinate systems.
Example (102100 is the WKID for the Web Mercator projection)
outSR=102100matchOutOfRange
A Boolean that specifies whether StreetAddress matches should be returned even when the input house number is outside of the house number range defined for the input street. Out-of-range matches have = . The geometry of such matches is a point corresponding to the end of the street segment where the range value is closest to the input house number. If match is not specified in a request, its value is set to true by default.
With the match parameter, better spatial accuracy is provided for inexact street address searches. Most street segments are assigned house number ranges. For example, Main Street may include house numbers from 2–100 on one side of the street and 1–99 on the other. A user may search for a house number that is not within this range, such as 109 Main Street. If match is passed in this request, the geocode service will return a StreetName-level match to Main Street, with geometry corresponding to the centroid of a street segment that most closely matches the input values. StreetName matches can be ambiguous because there may be multiple street segments with the same name that equally match the input. However, if match , in this case, a more precise geometry is returned to the specific side of the segment of Main Street with house number range 1–99.
matchOutOfRange=falselocationType
The location parameter specifies whether the output geometry of PointAddress matches should be the rooftop point or street entrance location. Valid values are rooftop and street . The default value is rooftop .
Geocode results include one geometry object (the location object) which defines the location of the address, as well as two sets of x,y coordinate values within the attributes object: X /Y , and DisplayX /DisplayY . In most cases, for geocode results with = or Subaddress , the X /Y attribute values describe the coordinates of the address along the street, while the Display /Display values describe the rooftop, or building centroid, coordinates. By default, the geometry returned for geocode results represents the rooftop location of the address (if the rooftop location is available in the source data). This is useful for most spatial analysis and map display purposes. However, for routing scenarios, it may be desirable to use the street location because the rooftop location of some addresses may be offset from a street by a large distance. For these cases, the location parameter can be used to specify that the street entrance geometry should be returned.
It is important to note that location is limited by the address data sources used by the ArcGIS Geocoding service. Not all PointAddress and Subaddress features include rooftop and street location coordinates. For some addresses, only a rooftop location is available; for others, only a street location is provided by the data source. For cases such as this, the location parameter may not function as expected. For example, if only rooftop location coordinates are available for an address, the rooftop geometry will be returned for the geocoded address even when location is requested.
locationType=streetsearchExtent
A set of bounding box coordinates that limit the search area to a specific region. This is especially useful for applications in which a user will search for places and addresses within the current map extent.
You can specify the spatial reference of the search coordinates, which is necessary if the map spatial reference is different than that of the ArcGIS Geocoding service; otherwise, the spatial reference of the coordinates is assumed to be the same as that of the ArcGIS Geocoding service.
The input can either be a comma-separated list of coordinates defining the bounding box or a JSON envelope object. The spatial reference of the bounding box coordinates can be included if an envelope object is used.
Refer to the Geocode addresses within an extent section below for more details about using search .
Example without a spatial reference
searchExtent=-104,35.6,-94.32,41Example with a spatial reference
searchExtent=
{
"xmin": -13052769,
"ymin": 3951172,
"xmax": -13019630,
"ymax": 3978490,
"spatialReference": {
"wkid": 3395
}
}langCode
The lang parameter sets the language in which geocode results are returned. Addresses and places in many countries are available in more than one language; in these cases, the lang parameter can be used to specify which language should be used for results returned by the geocode operation. This is useful for ensuring that results are returned in the expected language. For example, a web application could be designed to get the browser language and pass it as the lang parameter value in a geocode request.
See the table of supported countries for valid language code values in each country. The Supported Language Codes column provides the valid input values for the lang parameter. Full language names cannot be used with the lang parameter. Only one language code value can be included for the lang parameter in a geocode request.
If the lang parameter isn't included in a request, or if it is included but there are no matching features with the input language code, the resultant match is returned in the language code of the primary matched component from the input search string. Typically, this is either place-name or street name, depending on the search string.
Similarly, when there are multiple supported languages for a country, it doesn't mean that every address in the country is available in each of the languages. It may be the case that addresses are available in multiple languages for only one region of the country, or that each language is exclusive to a different region and there is no overlap. The following are some examples:
- Both English and French are listed as supported languages for Canada. However, there is no overlap between the languages for any addresses in most provinces. In the province of Quebec, only French addresses are available, while English is the only language used for addresses in Ontario.
- In Belgium, where three languages are supported (Dutch, French, and German), addresses are available in the city of Brussels in both Dutch and French. However, in the majority of the country, only a single language is used for addresses.
- In Greece, there is complete address coverage in both Greek and transliterated Greek languages (Greek words represented with Latin characters).
Due to variability of language coverage, the following logic is used to handle the different scenarios that may be encountered.
| Scenario | Result | Example |
|---|---|---|
Only one language is supported for an address, and no | Candidate is returned in the supported language. | Input (address in Geneva, Switzerland):
Output: |
Only one language is supported for an address, and an unsupported language is specified for the | Candidate is returned in the supported language. | Input (address in Geneva, Switzerland):
Output: |
Multiple languages are supported for an address, and no | Candidate is returned in the language of the primary matched component from the input string (street name or place-name). | Input (address in Brussels, Belgium):
Output: |
Multiple languages are supported for an address, and an unsupported language is specified for the | Candidate is returned in the language of the primary matched component from the input string (street name or place-name). | Input (address in Athens, Greece):
Output: |
Multiple languages are supported for an address, and a supported language is specified for the | Candidate is returned in the requested language. | Input (address in Athens, Greece):
Output: |
langCode=frpreferredLabelValues
The preferred parameter allows simple configuration of output fields returned in a response from the ArcGIS Geocoding service by specifying which address component values should be included in output fields. The parameter supports a single value or a comma-delimited collection of values as input. If the parameter is blank or excluded from a request, default address label formats will be used.
A particular address may have multiple city names associated with it. In the United States, for example, all addresses have a ZIP Code (postal code) assigned to them. Each ZIP Code has one or more associated locality names, which are known as postal cities. There is always one primary postal city value for each ZIP Code. ZIP Codes typically have no set boundaries, and the primary postal city name for the ZIP Code that is assigned to an address may be different than the name of the local city that the address is within.
For addresses in the United States, the ArcGIS Geocoding service includes the primary postal city in response output fields by default. As an example, postal code 45420 in Ohio has the primary postal city value Dayton. Addresses in the city of Kettering are assigned this postal code. It means that the default output fields for all geocoded addresses with postal code 45420, even those within the city of Kettering, will include Dayton as the city. To illustrate, if a user searches for 2109 E Dorothy Ln, O , the default match label returned in the response is 2109 E Dorothy Ln, Dayton, Ohio, 45420, even though the address is within the Kettering city limits.
Some organizations may prefer to include the local city name in the response instead of the postal city. The preferred can be used for this purpose. For the previous example, if preferred is included in the request, the output match label in the response will be 2109 E Dorothy Ln, Kettering, Ohio, 45420.
Similarly, streets may be known by multiple names. This is especially true with highways. For example, Pearblossom Hwy in California, which is the primary name, is also known as CA-138. The ArcGIS Geocoding service allows matching to addresses using either name as input, and by default will return the name that was matched to in the response.
Some organizations may prefer that the primary street name be returned in the response even if a user searches for an alternate street name, and they can use the preferred parameter to accomplish this. In other words, if a user searches for C , and preferred is included in the request, the match label returned in the response is Pearblossom Hwy, Pearblossom, California, 93553.
See the following table for supported parameter values.
| Parameter value | Description |
|---|---|
postalCity | Include the primary postal city value in geocoding response output fields, even if it is different than the city name in the geocoding request. This is the primary name assigned to the postal code of the address. |
localCity | Include the primary local city name in geocoding response output fields, even if it is different than the city name in the geocoding request. This is the name of the city that the address is within, and may be different than the postal city. |
matchedCity | If the input city name in a geocoding request matches any of the local city or postal city names associated with an address, include the matched value in geocoding response output fields. If a city name is not included in the input, or is included but doesn't match to anything, default address formats will be used. |
primaryStreet | Include the primary street name in geocoding response output fields, even if it is different than the street name in the geocoding request. |
matchedStreet | If the input street name in a geocoding request matches any of the supported street names assigned to an address, include the matched value in geocoding response output fields. |
Here are additional details about the preferred parameter
- The
preferredparameter takes a comma-delimited collection of values as input.Label Values - The parameter values correspond to two groups—a City group and a Street group, indicated by the suffix of the value name. The
postal,City local, andCity matchedvalues are part of the City group. TheCity primaryandStreet matchedvalues are part of the Street group.Street - A geocode request can include one City value and one Street value—for instance:
preferred.Label Values=primary Street,postal City - A request can only include one value per group. In other words, a request with
preferredis invalid.Label Values=matched City,postal City
Example: Single label value
preferredLabelValues=matchedCityExample: Multiple label values
preferredLabelValues=matchedCity,primaryStreetoutFields
The list of fields to be returned within the attributes object of the geocode response. Descriptions for each of these fields are available in the Service output topic.
Unless otherwise specified, all output fields are returned in a geocode response (refer to this example to see the full set of output fields). The out parameter can be used to limit the result set by allowing specific fields to be returned, which is useful if not all fields are required for a user workflow.
If out is passed in a geocode request, only the minimum set of components is included in the response. This includes the Result field, which is always part of the geocode response no matter which values are defined for the out parameter. The minimum set of objects includes the following:
spatialReference locations(full address and x,y coordinates of the match location)scoreattributes(including theResultoutput field)ID
Examples that return all output fields
outFields=*
outFields=Example that returns a partial set of output fields
outFields=AddNum,StAddr,CityExample that returns the minimum set of output fields
outFields=nonecomprehensiveZoneMatch
A Boolean that allows you to disable matching to inexact administrative zones or postal codes present in a geocode request.
By default the ArcGIS Geocoding service supports fuzzy matching of administrative zones (neighborhoods, districts, and cities) and postal codes when such values are present in searches for addresses and places. This is because admin zone and postal boundaries are often ambiguous, and a person may not know the exact neighborhood or postal code of the address they want to geocode.
If this fuzzy matching is not desired, you can include comprehensive in the request. Strict matching of admin zones and postal codes is used, and heavier penalties are applied to the result if the input admin or postal values aren't exactly matched.
Example
comprehensiveZoneMatch=falseResponse status
| Status | Meaning | Description | Schema |
|---|---|---|---|
200 | OK | A successful response for a | Inline |
400 | Bad request | Invalid query parameters. Learn more in Service output. | |
403 | Forbidden | The required paramter | |
5 | Unknown | An error occured on the server. Learn more in Service output. |
Go to Service output for extended codes.
The geocode REST operation results in an output JSON response. However, the REST request may not always successfully return results. A variety of things could cause a REST request to fail:
- Incorrect authentication (token required or invalid token).
- Incorrect syntax in the request. Ensure the request being sent is properly formatted.
- Internet connectivity issues.
- Server time-out.
You can write code to handle these request failures caused by server time-outs. When a time-out occurs, your code will need to do the following:
- Recognize the time-out in the JSON response.
- Split the request into smaller batch sizes and resubmit the request as two separate requests. Each new request will be half the size of the original request and will contain half the addresses.
- See whether each request succeeds. If one of the batches fails due to a time-out, continue the process of splitting the failing batch in two and sending both requests.
- If a request is sent with only one address and it times out, manually write that record as unmatched and continue processing requests.
- Continue this process until all batch requests have completed successfully.
The retry logic described above is the recommended best practice when using the geocode operation. The Geocode Addresses, Geocode File, and Geocode Locations from Table geoprocessing tools in ArcGIS Pro already use this logic to ensure batch geocoding never fails against a geocode service.
Response details
{
"spatialReference": {
"wkid": "<spatialReference>",
"latestWkid": "<spatialReference>"
},
"locations": [
{
"address": "<address>",
"location": {
"x": "<longitude>",
"y": "<latitude>"
},
"score": "<score>",
"attributes": {
"ResultID": "<ResultID>",
"Loc_name": "<Loc_name>",
"Status": "<Status>",
"Score": "<Score>",
"Match_addr": "<Match_addr>",
"LongLabel": "<LongLabel>",
"ShortLabel": "<ShortLabel>",
"Addr_type": "<Addr_type>",
"Type": "<Type>",
"PlaceName": "<PlaceName>",
"Place_addr": "<Place_addr>",
"Phone": "<Phone>",
"URL": "<URL>",
"Rank": "<Rank>",
"AddBldg": "<AddBldg>",
"AddNum": "<AddNum>",
"AddNumFrom": "<AddNumFrom>",
"AddNumTo": "<AddNumTo>",
"AddRange": "<AddRange>",
"Side": "<Side>",
"StPreDir": "<StPreDir>",
"StPreType": "<StPreType>",
"StName": "<StName>",
"StType": "<StType>",
"StDir": "<StDir>",
"BldgType": "<BldgType>",
"BldgName": "<BldgName>",
"LevelType": "<LevelType>",
"LevelName": "<LevelName>",
"UnitType": "<UnitType>",
"UnitName": "<UnitName>",
"SubAddr": "<SubAddr>",
"StAddr": "<StAddr>",
"Block": "<Block>",
"Sector": "<Sector>",
"Nbrhd": "<Nbrhd>",
"District": "<District>",
"City": "<City>",
"MetroArea": "<MetroArea>",
"Subregion": "<Subregion>",
"Region": "<Region>",
"RegionAbbr": "<RegionAbbr>",
"Territory": "<Territory>",
"Zone": "<Zone>",
"Postal": "<Postal>",
"PostalExt": "<PostalExt>",
"Country": "<Country>",
"LangCode": "<LangCode>",
"Distance": "<Distance>",
"X": "<X>",
"Y": "<Y>",
"DisplayX": "<DisplayX>",
"DisplayY": "<DisplayY>",
"Xmin": "<Xmin>",
"Xmax":" <Xmax>",
"Ymin":" <Ymin>",
"Ymax":" <Ymax>",
"ExInfo": "<ExInfo>"
}
}
]
}
Examples
Batch geocode two addresses
Multifield
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?addresses={"records":
[{"attributes":{"OBJECTID":1,"Address":"380 New York St.","City":"Redlands","Region":"CA","Postal":"92373"}},{"attributes":{"OBJECTID":2,"Address":"1 World Way","City":"Los Angeles","Region":"CA","Postal":"90045"}}]}&sourceCountry=USA&f=pjson&token=<ACCESS_TOKEN>Single-field
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?addresses={"records":[{"attributes":{"OBJECTID":1,"SingleLine":"380 New York St., Redlands, CA, 92373"}},{"attributes":{"OBJECTID":2,"SingleLine":"1 World Way, Los Angeles, CA, 90045"}}]}&sourceCountry=USA&f=pjson&token=<ACCESS_TOKEN>Filter categories
The geocode operation supports batch geocode filtering by category values, which represent address and place types. By including the category parameter in a geocode request, you can avoid false positive matches to unexpected place and address types due to ambiguous input.
For example, a user has a table of three-letter airport codes that they want to geocode. There may be city or business names that are the same as an airport code, causing false positive matches to other places. However the user can ensure that only airport matches are returned by specifying category=airport in the request.
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?addresses={"records":[{"attributes":{"OBJECTID":1,"SingleLine":"LAX",}},{"attributes":{"OBJECTID":2,"SingleLine":"SFO",}}]}&category=airport&f=pjson&token=<ACCESS_TOKEN>Batch geocode with fallback allowed
You can also use category filtering to avoid low resolution fallback matches. By default, if the ArcGIS Geocoding service cannot find a match for an input address, it will automatically search for a lower match level, such as a street name, city, or postal code. For batch geocoding, a user may prefer that no match is returned in such cases so that they are not charged for the geocode. If a user passes category= in a geocode request, no fallback will occur if address matches cannot be found; the user will only be charged for the address matches.
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?addresses={"records":[{"attributes":{"OBJECTID":1,"SingleLine":"380 New York St Redlands CA 92373",}},{"attributes":{"OBJECTID":2,"SingleLine":"Escondido CA",}}]}&category=&f=pjson&token=<ACCESS_TOKEN>Batch geocode with no fallback allowed
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?addresses={"records":[{"attributes":{"OBJECTID":1,"SingleLine":"380 New York St Redlands CA 92373",}},{"attributes":{"OBJECTID":2,"SingleLine":"Escondido CA",}}]}&category=Point Address&f=pjson&token=<ACCESS_TOKEN>See the topic Category filtering for details.
Batch geocode a set of coordinates
The ArcGIS Geocoding service supports batch geocoding of coordinates with the geocode operation. The output is a geometry point with a match address that is the same as the input coordinates. This is different than reverse geocoding, in which input x,y coordinates are resolved to a matching street address; see reverseGeocode for more information. The following types of coordinates are supported for batch geocoding:
- x,y coordinates; x refers to longitude (east-west coordinates), and y refers to latitude (north-south coordinates)
- Military Grid Reference System (MGRS) coordinates
- United States National Grid (USNG) coordinates
Detailed information about valid input formats for coordinate geocoding is provided in the findAddressCandidates topic. Examples for batch geocoding coordinates with the geocode operation are provided below.
Longitude and latitude
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?addresses={"records":[{"attributes":{"OBJECTID":1,"SingleLine":"18.9919543,47.5283605",}},{"attributes":{"OBJECTID":2,"SingleLine":"Y:47.5283605 X:18.9919543",}}]}&f=pjson&token=<ACCESS_TOKEN>MGRS coordinates
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?addresses={"records":[{"attributes":{"OBJECTID":1,"SingleLine":"18SUH6789043210",}},{"attributes":{"OBJECTID":2,"SingleLine":"19TDJ5538855106",}}]}&f=pjson&token=<ACCESS_TOKEN>Batch geocode points of interest
The ArcGIS Geocoding service supports batch geocoding of POIs with the geocode operation. A POI is a named point location that can represent a cultural or geographic landmark or a business. For example, you can find amusement parks, museums, schools, restaurants, hotels, gas stations, or other types of businesses or landmarks, as well as geographic features, such as mountains, lakes, rivers, or deserts.
As with street addresses, you can search for POIs with geocode using the single-field or multifield approach.
Single-field POI search
To search for POIs with single-field search, use the single parameter. In general, valid single POI search strings can be formatted in variations of three basic structures:
- <name> <optional connector> <zone>
- <zone> <name>
- <name><address><zone>
Where
- <name> = A place-name, such as Disneyland, Starbucks, or Niagra Falls.
- <zone> = A postal code or administrative boundary—such as neighborhood, city, subregion, region, country, or any combination thereof—that provides a spatial boundary to the search. It can be included in the search to limit matching candidates but is not required.
- <optional connector> =
inorat; this is not required for the search. - <address> = A street name, such as
Main St, or a complete street address, such as590 N Main St.
Examples of valid single search strings include the following:
Business name searches
- Starbucks San Diego
- Starbucks in San Diego
- San Diego Starbucks
- Starbucks 92101
- Starbucks 5th Ave San Diego
- Reuben H Fleet Science Center, 1875 El Prado, San Diego, CA, 92101, USA
Multifield POI search
When searching for POIs using multifield input, the name of the POI must be passed as the value for the address parameter. The zone information can be passed in the postal , neighborhood , city , subregion , region , and country parameters. If searching for POI + address, the address should be passed as the value for the address2 parameter.
Batch geocode amusement parks
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?addresses={"records":[{"attributes":{"OBJECTID":1,"SingleLine":"universal studios los angeles",}},{"attributes":{"OBJECTID":2,"SingleLine":"disneyland anaheim",}}]}&f=pjson&token=<ACCESS_TOKEN>Batch geocode place names with addresses
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?addresses={"records":[{"attributes":{"OBJECTID":1,"SingleLine":"Starbucks, 5th Ave, San Diego",}},{"attributes":{"OBJECTID":2,"SingleLine":"San Diego Zoo, 2920 Zoo Dr, San Diego",}}]}&category=&sourceCountry=&matchOutOfRange=true&langCode=&locationType=&searchExtent=&outSR=&outFields=&preferredLabelValues=&f=pjson&token=<ACCESS_TOKEN>Geocode addresses within an extent
The geocode operation allows spatial filtering of search results by using the search parameter. If you want to confine a search to a localized area, something that is especially useful in a mobile application, you can define a bounding rectangle to search within. No candidates outside of the rectangle are returned. When bounding rectangle coordinates are entered as a simple comma-separated string in the format <lower left corner>,<upper right corner>, the coordinates must be in the default spatial reference of the geocode service, which is WGS84. The search parameter can be used with all supported search types (street address, POI, admin place, postal code).
The search parameter is not intended to be used with extents that cover large areas, such as entire countries or provinces/states. Geocoding quality and performance may be reduced with large search values. For example, if a request includes a search that covers the state of California, an ambiguous input address such as 100 Main St would cause an excessive number of matching candidates to be generated, which would slow down the response. To counteract such a delay, the service may not process all possible candidates, leading to unexpected results.
The following best practices will help you avoid issues when using search :
- Reduce the
searcharea. Ideally, the size of the extent should not exceed an area corresponding to a map scale of approximately 1:1,000,000.Extent - Include an administrative zone (such as city) or postal code in the request when searching for a place or address. For instance, instead of searching for
100 Main St, be more specific and search for100 Main St, Barstow.
The example URL below illustrates how to exclude candidates that are outside a specified extent from being returned by using the search parameter. In this example, two addresses are passed to geocode , along with a search value corresponding to downtown Detroit. Only one of the input addresses is located within the extent, and no match is returned for the other address.
Only return address matches in downtown Detroit
Single-field
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?addresses={"records":[{"attributes":{"OBJECTID":1,"SingleLine":"315 Bagley St, Detroit, Michigan, 48226",}},{"attributes":{"OBJECTID":2,"SingleLine":"24241 Scotia Rd, Detroit, Michigan, 48237",}}]}&searchExtent=-83.06757808033565,42.32169269843457,-83.03015590015993,42.3455495740986&category=Address&f=pjson&token=<ACCESSTOKEN>Multifield
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?addresses={"records":[{"attributes":{"OBJECTID":1,"Address":"315 Bagley St","City":"Detroit","Region":"Michigan","Postal":"48226"}},{"attributes":{"OBJECTID":2,"Address":"24241 Scotia Rd","City":"Detroit","Region":"Michigan","Postal":"48237"}}]}&searchExtent=-83.06757808033565,42.32169269843457,-83.03015590015993,42.3455495740986&category=Address&f=pjson&token=<ACCESSTOKEN>Specify different city and street names for output fields
The preferred parameter allows limited customization of output values in geocode responses. Refer to the parameter overview for details about its functionality; this section includes examples showing how it can be used.
The parameter can be used to override the default city and street names returned in output fields for a geocoding transaction. The default values are based on country addressing conventions and data availability. For instance, United States addresses returned by the ArcGIS Geocoding service include the primary city name assigned to the postal code that is associated with the address; this is known as the postal city name. Sometimes the postal city name is different than the name of the city whose boundaries the address is within (known as the local city name). Streets may be known by multiple names as well. For streets that have more than one name, the ArcGIS Geocoding service returns the name that was matched to from the request in the geocoding results by default.
For the following addresses, the streets have multiple names and the local city name differs from the postal city name.
| Address | Primary street name | Alternate street name | Local city name | Postal city name |
|---|---|---|---|---|
635 CR-30, Olmstedville, NY 12857 | Church Rd | CR-30 | Town of Minerva | Olmstedville |
7608 National Pike, Uniontown, Pennsylvania, 15401 | US-40 | National Pike | Menallen Township | Uniontown |
The examples below illustrate how to modify the city and street names returned in a batch geocode response for these addresses by using the preferred parameter. The first example shows what the geocode results look like without preferred . The second example shows how to use preferred to return the primary street names and local city names in geocoding results for the same input addresses.
Here is what the addresses parameter looks like in PJSON for the example addresses in single-field format (use with POST requests):
addresses=
{ "records": [
{
"attributes": {
"OBJECTID": 1,
"SingleLine": "635 CR-30, Olmstedville, NY 12857"
}
},
{
"attributes": {
"OBJECTID": 2,
"SingleLine": "7608 National Pike, Uniontown, Pennsylvania, 15401"
}
}
]
}Here is what the addresses parameter looks like in PJSON for these addresses in multifield format (use with POST requests):
addresses=
{ "records": [
{
"attributes": {
"OBJECTID": 1,
"Address": "635 CR-30",
"City": "Olmstedville",
"Region": "NY",
"Postal": "12857"
}
},
{
"attributes": {
"OBJECTID": 2,
"Address": "7608 National Pike",
"City": "Uniontown",
"Region": "Pennsylvania",
"Postal": "15401"
}
}
]
}Batch geocode two addresses without preferred Label Values
Without using the preferred parameter in the geocode request for these addresses, the alternate street names and postal city names are shown in the output geocoding results.
Single-field
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?addresses={"records":[{"attributes":{"OBJECTID":1,"SingleLine":"635 CR-30, Olmstedville, NY 12857",}},{"attributes":{"OBJECTID":2,"SingleLine":"7608 National Pike, Uniontown, Pennsylvania, 15401",}}]}&preferredLabelValues=&f=pjson&token=<ACCESSTOKEN>Multifield
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?addresses={"records":[{"attributes":{"OBJECTID":1,"Address":"635 CR-30","City":"Olmstedville","Region":"NY","Postal":"12857"}},{"attributes":{"OBJECTID":2,"Address":"7608 National Pike","City":"Uniontown","Region":"Pennsylvania","Postal":"15401"}}]}&preferredLabelValues=&f=pjson&token=<ACCESSTOKEN>By including preferred in the geocode request for the same input addresses, the output street and city names are different than the previous example.
Batch geocode with preferred Label Values
Single-field
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?addresses={"records":[{"attributes":{"OBJECTID":1,"SingleLine":"635 CR-30, Olmstedville, NY 12857",}},{"attributes":{"OBJECTID":2,"SingleLine":"7608 National Pike, Uniontown, Pennsylvania, 15401",}}]}&preferredLabelValues=localCity,primaryStreet&f=pjson&token=<ACCESSTOKEN>Multifield
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?addresses={"records":[{"attributes":{"OBJECTID":1,"Address":"635 CR-30","City":"Olmstedville","Region":"NY","Postal":"12857"}},{"attributes":{"OBJECTID":2,"Address":"7608 National Pike","City":"Uniontown","Region":"Pennsylvania","Postal":"15401"}}]}&preferredLabelValues=localCity,primaryStreet&f=pjson&token=<ACCESSTOKEN>Specify output fields
The geocode operation allows you to specify individual output fields or return all output fields in a response. The out parameter is used for this. If you want to return all supported output fields, set out , out , or exclude the parameter from the request. If you only want to return the minimum set of default output fields, set out . If you want to return specific fields, pass the desired field names as comma-separated values in the request, such as out .
See Service output for details about the fields returned by a geocode request.
The examples below illustrate how to control the fields that are included in a geocode response by using the out parameter. The first example shows what the geocode results look like when a partial set of output fields is defined for out . The second example shows how to use out to return the minimum set of default output fields.
Return a partial set of output fields
Single-field
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?addresses={"records":[{"attributes":{"OBJECTID":1,"SingleLine":"269 Lonsdale St, Melbourne, Victoria",}},{"attributes":{"OBJECTID":2,"SingleLine":"30 Flemington Rd, Melbourne, Victoria",}}]}&outFields=Addr_type,AddNum,StName,StType,Nbrhd,City,Region,Postal,Country&f=pjson&token=<ACCESSTOKEN>Multifield
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?addresses={"records":[{"attributes":{"OBJECTID":1,"Address":"269 Lonsdale St","City":"Melbourne","Region":"Victoria",}},{"attributes":{"OBJECTID":2,"Address":"30 Flemington Rd","City":"Melbourne","Region":"Victoria",}}]}&outFields=Addr_type,AddNum,StName,StType,Nbrhd,City,Region,Postal,Country&f=pjson&token=<ACCESSTOKEN>Return the minimum set of output fields
Single-field
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?addresses={"records":[{"attributes":{"OBJECTID":1,"SingleLine":"269 Lonsdale St, Melbourne, Victoria",}},{"attributes":{"OBJECTID":2,"SingleLine":"30 Flemington Rd, Melbourne, Victoria",}}]}&outFields=none&f=pjson&token=<ACCESSTOKEN>Multifield
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?addresses={"records":[{"attributes":{"OBJECTID":1,"Address":"269 Lonsdale St","City":"Melbourne","Region":"Victoria",}},{"attributes":{"OBJECTID":2,"Address":"30 Flemington Rd","City":"Melbourne","Region":"Victoria",}}]}&outFields=none&f=pjson&token=<ACCESSTOKEN>Disable fuzzy zone matching
The ArcGIS Geocoding service supports fuzzy matching to administrative zones (neighborhoods, districts, cities) or postal codes in requests which may not be exactly the same as the values associated with the geocoded address. If strict matching is preferred, you can include comprehensive in a request to disable fuzzy matching.
Look at the examples below to see how disabling fuzzy zone matching affects geocoding results.
Geocode with comprehensive Zone Match=true
Single-field
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?addresses={"records":[{"attributes":{"OBJECTID":1,"SingleLine":"1535 N Broadway, 92025",}},{"attributes":{"OBJECTID":2,"SingleLine":"380 New York St, 92374",}}]}&comprehensiveZoneMatch=true&outFields=Match_addr,Addr_type,Score&f=pjson&token=<ACCESSTOKEN>Multifield
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?addresses={"records":[{"attributes":{"OBJECTID":1,"Address":"1535 N Broadway","Postal":"92025",}},{"attributes":{"OBJECTID":2,"Address":"380 New York St","Postal":"92374",}}]}&comprehensiveZoneMatch=true&outFields=Match_addr,Addr_type,Score&f=pjson&token=<ACCESSTOKEN>Geocode with comprehensive Zone Match=false
Single-field
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?addresses={"records":[{"attributes":{"OBJECTID":1,"SingleLine":"1535 N Broadway, 92025",}},{"attributes":{"OBJECTID":2,"SingleLine":"380 New York St, 92374",}}]}&comprehensiveZoneMatch=false&outFields=Match_addr,Addr_type,Score&f=pjson&token=<ACCESSTOKEN>Multifield
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses?addresses={"records":[{"attributes":{"OBJECTID":1,"Address":"1535 N Broadway","Postal":"92025",}},{"attributes":{"OBJECTID":2,"Address":"380 New York St","Postal":"92374",}}]}&comprehensiveZoneMatch=false&outFields=Match_addr,Addr_type,Score&f=pjson&token=<ACCESSTOKEN>