/reverseGeocode

GETGETPOST
Use dark colors for code blocksCopy
1
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode

The /reverseGeocode request determines the address at a particular x,y location. You pass the coordinates of a point location and the service returns the address or place that is closest to the location.

Parameters

NameRequiredTypeDefaultDescription
string

The request response format, either json or pjson

string

An access token with the required privileges.

string | point

The point from which to search for the closest address.

number

4326

The spatial reference of the x and y coordinates returned in a response.

boolean

Specifies whether the results of a request are stored.

string

Limits the possible match types.

boolean

false

Returns street intersections. This parameter has been replaced by featureTypes.

string

rooftop

Specifies whether output geometry of PointAddress and Subaddress matches should be the rooftop point or street entrance.

string

Returns specified address component values included in output fields.

string | *

The list of fields to be returned within the attributes object of a response.

boolean

false

Specifies which coordinates should be returned in the X and Y output fields within the location object of the JSON response

Required parameters

f

The response format.

Use dark colors for code blocksCopy
1
f=json

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
Use dark colors for code blocksCopy
1
token=<ACCESS_TOKEN>

Learn more about access tokens and privileges in the Security and authentication developer guide.

location

The point from which to search for the closest address. The point can be represented as a simple, comma-separated syntax or as a JSON point object.

The spatial reference of the comma-separated syntax is always WGS84 (in decimal degrees), the same coordinate system as the ArcGIS Geocoding service.

Use JSON formatting to specify any other coordinate system for the input location. Specifically, set the spatial reference using its well-known ID (WKID) value. For a list of valid WKID values, see Projected coordinate systems and Geographic coordinate systems.

Example using simple syntax and the default WGS84 spatial reference

Use dark colors for code blocksCopy
1
location=103.8767227,1.3330736

Example using JSON and the default WGS84 spatial reference

Use dark colors for code blocksCopy
1
location={x: 103.876722, y: 1.3330736}

Example using JSON and specifying a spatial reference (WGS84 Web Mercator Auxiliary Sphere)

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
location=
{
    "x": 11563503,
    "y": 148410,
    "spatialReference": {
        "wkid": 3857
    }
}

Optional parameters

outSR

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 outSR 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)

Use dark colors for code blocksCopy
1
outSR=102100

langCode

The langCode parameter sets the language in which reverse-geocoded addresses are returned. Addresses in many countries are available in more than one language; in these cases, the langCode parameter can be used to specify which language should be used for addresses returned by the reverseGeocode operation. This is useful for ensuring that addresses are returned in the expected language. For example, a web application could be designed to get the browser language and pass it as the langCode parameter value in a reverseGeocode 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 langCode parameter. Full language names cannot be used with the langCode parameter. Only one language code value can be included for the langCode parameter in a reverseGeocode request.

The default language code for each country is the first one listed in the Supported Language Codes column, highlighted with bold text. It is the default language of addresses returned by the reverseGeocode operation for a particular country. For countries with multiple supported languages, the default language is the one spoken by the highest percentage of the country's population. For some countries, not all addresses are available in the default language. If the langCode 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 country's default language code.

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 at all. 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 translated with Latin characters).

Due to variability of language coverage, the following logic is used to handle the different scenarios that may be encountered.

ScenarioResultExample

No langCode value is specified and only one language is supported at the input location.

Address is returned in the supported language.

Location in Geneva, Switzerland (only French addresses are supported)

Address returned in French language.

No langCode value is specified and multiple languages are supported at the input location.

Address is returned in the country's default language.

Location in Brussels, Belgium (Dutch and French addresses are supported; Dutch is the default language)

Address returned in Dutch language.

An invalid langCode value is specified and only one language is supported at the input location.

Address is returned in the supported language.

Location in Geneva, Switzerland (only French addresses are supported), and langCode=zh

Address returned in French language.

An invalid langCode is specified and multiple languages are supported at the input location; the input langCode is a Latin-based script and a transliterated address exists at the location.

Address is returned in the transliterated language.

Location in Athens, Greece (Greek and transliterated Greek are supported), and langCode=fr

Transliterated address is returned.

An invalid langCode is specified and multiple languages are supported at the input location; the input langCode is not a Latin-based script.

Address is returned in the country's default language.

Location in Athens, Greece (Greek and transliterated Greek are supported; Greek is the default language), and langCode=ru

Address returned in Greek language.

Example

Use dark colors for code blocksCopy
1
langCode=fr

forStorage

Specifies whether the results of the operation will be persisted. The default value is false , which indicates the results of the operation can't be stored, but they can be temporarily displayed on a map, for instance. If you store the results, in a database, for example, you need to set this parameter to true .

Applications are contractually prohibited from storing the results of geocoding transactions unless they make the request by passing the forStorage parameter with a value of true and the token parameter with a valid token. Instructions for composing a request with a valid token are provided in Security and authentication.

To learn more about free and paid geocoding operations, stored versus not stored geocoding are explained further.

Example

Use dark colors for code blocksCopy
1
forStorage=true

featureTypes

The featureTypes parameter limits the possible match types returned by the reverseGeocode operation. Valid values are listed in the feature type hierarchy table. Single or multiple values can be included in the request. If a single value is included, the search tolerance for the input feature type is 500 meters. If multiple values are included, the default search distances specified in the feature type hierarchy table are applied.

Example (single featureTypes value)

Use dark colors for code blocksCopy
1
featureTypes=PointAddress

Example (multiple featureTypes values)

Use dark colors for code blocksCopy
1
featureTypes=PointAddress,StreetAddress

returnIntersection

The returnIntersection parameter has been replaced by the featureTypes parameter for returning street intersection matches with reverseGeocode . It is only supported for backward compatibility with legacy apps. The featureTypes parameter should be used instead of returnIntersection . If you want to return the nearest street intersection to the input location, pass featureTypes=StreetInt in the reverseGeocode request.

A Boolean that indicates whether the service should return the nearest street intersection to the input location. If true , the closest intersection to the input location is returned; if false , the closest address or place to the input location is returned. The default value is false .

Example

Use dark colors for code blocksCopy
1
returnIntersection=true

locationType

Specifies whether the output geometry of PointAddress and Subaddress 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 =PointAddress or Subaddress , the X /Y attribute values describe the coordinates of the address along the street, while the DisplayX /DisplayY 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 locationType parameter can be used to specify that the street entrance geometry should be returned.

It is important to note that locationType 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 locationType 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 locationType=street is requested.

Example

Use dark colors for code blocksCopy
1
locationType=street

preferredLabelValues

The preferredLabelValues 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. It supports a single value 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 instance, 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. For example, postal code 45420 in Ohio has the primary postal city value Dayton. Addresses in the neighboring city of Kettering are assigned this postal code. It means that the default output fields for all reverse geocoded addresses with postal code 45420, even those within the city of Kettering, will include Dayton as the city. To illustrate, if a user reverse geocodes latitude/longitude coordinates -84.1252005,39.703149 , the match address 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 preferredLabelValues can be used for this purpose. For the previous example, if preferredLabelValues=localCity is included in the request, the output match address in the response will be 2109 E Dorothy Ln, Kettering, Ohio, 45420.

See the following table for supported parameter values.

Parameter valueDescription

postalCity

Include the primary postal city value in geocoding response output fields. 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. This is the name of the city that the address is within, and may be different than the postal city.

Example: Single label value

Use dark colors for code blocksCopy
1
preferredLabelValues=localCity

outFields

The list of fields to be returned within the address object of the reverseGeocode JSON response. Descriptions for each of the reverseGeocode output fields are available in the Output fields section of this document. The reverseGeocode output fields are those for which "Supported request types" = "reverseGeocode" in the table.

The reverseGeocode response consists of two objects: address and location . The location object includes the fields that are used for displaying reverse geocode results in a mapping application. The address object includes fields which provide details about the address or place returned for the reverseGeocode request, such as the full address, city, place name, and others. The outFields parameter is only relevant for the address object. The location object is not affected by it.

By default, all possible output fields are returned in the response. In other words, passing outFields= (blank) in the request is functionally the same as passing outFields=* .

Examples that returns all output fields

Use dark colors for code blocksCopy
1
outFields=*

Example that returns the specified fields only

Use dark colors for code blocksCopy
1
outFields=Match_addr,Addr_type,CountryCode

returnInputLocation

The returnInputLocation parameter is a Boolean which can be used to specify which coordinates should be returned in the X and Y output fields within the location object of the JSON response. The default value is false .

  • If true , then the coordinates which were included in the reverseGeocode request for the location parameter are returned in the X and Y output fields in the location object of the JSON response.
  • If false, then the coordinates of the reverse geocoded location are returned in the X and Y output fields in the location object of the JSON response.

Example

Use dark colors for code blocksCopy
1
returnInputLocation=true

Response status

StatusMeaningDescriptionSchema
200
OK

A successful response for a /reverseGeocode request.

Inline

400
Bad request

Invalid query parameters. Learn more in Service output.

Error

403
Forbidden

The required paramter token is valid but does not have permission to access the service. Learn more in Service output.

Error

5XX
Unknown

An error occured on the server. Learn more in Service output.

Error

Go to Service output for extended codes.

Response details

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

{
  "address": {
    "Match_addr": "<MatchAddress>",
    "LongLabel": "<LongLabel>",
    "ShortLabel": "<ShortLabel>",
    "Addr_type": "<AddressType>",
    "Type": "<Type>",
    "PlaceName": "<PlaceName>",
    "AddNum": "<AddressNumber>",
    "Address": "<StreetAddress>",
    "Block": "<Block>",
    "Sector": "<Sector>",
    "Neighborhood": "<Neighborhood>",
    "District": "<District>",
    "City": "<City>",
    "MetroArea": "<MetroArea>",
    "Subregion": "<Subregion>",
    "Region": "<Region>",
    "Territory": "<Territory>",
    "Postal": "<PostalCode>",
    "PostalExt": "<PostalExtension>",
    "CountryCode": "<CountryCode>",
    "StrucType": "<StructureType>",
    "StrucDet": "<StructureDetails>"
  },
  "location": {
    "x": "<longitude>",
    "y": "<latitude>",
    "spatialReference": {
      "wkid": "<WKID>",
      "latestWkid": "<LatestWkid>"
    }
  }
}

Examples

Match to POI centroid returned

In this example, which corresponds to callout 1 in the graphic above, the input location is within the search tolerance of both POI and PointAddress features, but a match to the POI centroid is returned because it has a higher priority.

Use dark colors for code blocksCopy
1
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?f=pjson&featureTypes=&location=-117.205525,34.038232&token=<ACCESS_TOKEN>

Match to POI area returned

In this example, which corresponds to callout 2 in the graphic above, the input location is within a POI area feature, so a POI match is returned.

Use dark colors for code blocksCopy
1
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?f=pjson&featureTypes=&location=-117.205525792308,34.037072461598&token=<ACCESS_TOKEN>

StreetAddress match returned

In this example, which corresponds to callout 3 in the graphic above, the input location intersects a POI area feature and a StreetAddress buffer. A StreetAddress match is returned since it has a higher priority than POI areas. */}

Use dark colors for code blocksCopy
1
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?f=pjson&featureTypes=&location=-117.20700637168703,34.03582108290202&token=<ACCESS_TOKEN>

PointAddress match returned

In this example, which corresponds to callout 4 in the graphic above, the input location is within the search tolerance of a PointAddress feature, so a PointAddress match is returned.

Use dark colors for code blocksCopy
1
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?f=pjson&featureTypes=&location=-117.20689908332648,34.03431629224423&token=<ACCESS_TOKEN>

Locality match returned

In this example, which corresponds to callout 5 in the graphic above, the input location is outside the tolerance of address and POI features, so the service returns a match to the smallest (by area) administrative or postal boundary feature that the location intersects. In this case, a match to the Live Oak Canyon neighborhood is returned.

Use dark colors for code blocksCopy
1
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?f=pjson&featureTypes=&location=-117.205794,34.035115&token=<ACCESS_TOKEN>

StreetAddress match returned instead of StreetInt

In this example, which corresponds to callout 6 in the graphic above, the input location is within the tolerance of both StreetInt and StreetAddress features. Even though StreetInt has a higher priority than StreetAddress, a StreetAddress match is returned. This is because intersection matches are only returned by reverseGeocode if the request includes featureTypes=StreetInt . The featureTypes parameter is empty in this case.

Use dark colors for code blocksCopy
1
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?f=pjson&featureTypes=&location=-117.203741,34.036609&token=<ACCESS_TOKEN>

Choose specific output features

The featureTypes parameter can be used to specify one or more match types to be returned by a reverseGeocode request. If one value is included for featureTypes , the search tolerance is extended to 500 meters. If the featureTypes parameter includes multiple values, the search tolerances defined in the feature types hierarchy table are used. Details for the logic used by the featureTypes parameter are described below.

Reverse geocode an intersection

In this example, you'll use the featureTypes parameter to return a StreetInt match with a reverseGeocode request. This example uses the same input location as example 6 above.

Use dark colors for code blocksCopy
1
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?f=pjson&featureTypes=StreetInt&location=-117.203741,34.036609&token=<ACCESS_TOKEN>

Reverse geocode a distant PointAddress

In this example, you'll use the featureTypes parameter to return a match to a PointAddress feature when the input location is outside the default PointAddress search tolerance. Because PointAddress is the only value included for the featureTypes parameter in this reverseGeocode request, the search tolerance is 500 meters, which allows more distant PointAddress matches to be returned.

Use dark colors for code blocksCopy
1
GET https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?f=pjson&featureTypes=PointAddress&location=-117.205958,34.035039&token=<ACCESS_TOKEN>

Multiple input featureTypes values

A typical use case for the featureTypes parameter is to exclude matches to nonaddress features, which can be accomplished by setting featureTypes=PointAddress,StreetAddress . In this example, the input location is within the search tolerance of both POI and PointAddress features, but a match to the PointAddress is returned because featureTypes is used to exclude the POI match. This example uses the same input location as example 1 above.

Use dark colors for code blocksCopy
1
GET https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?f=pjson&featureTypes=PointAddress,StreetAddress&location=-117.205453,34.037988&token=<ACCESS_TOKEN>

Reverse geocode examples with langCode

Greek is the default language for features in Greece. However, many features are also available in English. This example shows how to return English reverse geocoding results for locations in Greece.

Reverse geocode a location with langCode=EN

Use dark colors for code blocksCopy
1
GET https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?f=pjson&langCode=EN&location=23.73687,37.975252&token=<ACCESS_TOKEN>

Reverse geocode a location with langCode=AR

In Israel, some addresses are available in both Hebrew and Arabic languages. Hebrew is the default language, so langCode=AR must be included in the reverseGeocode request to return matches in Arabic.

Use dark colors for code blocksCopy
1
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?f=pjson&langCode=AR&location=34.71402,31.79373&token=<ACCESS_TOKEN>

Reverse geocode examples with the preferredLabelValues parameter

The preferredLabelValues parameter allows limited customization of output values in reverseGeocode responses. Refer to the parameter overview for details about its functionality; this section includes examples showing how it can be used.

Reverse geocode a location without preferredLabelValues .

Use dark colors for code blocksCopy
1
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?f=pjson&featureTypes=PointAddress&preferredLabelValues=&location=-93.13726,44.803809&token=<ACCESS_TOKEN>

Reverse geocode a location with preferredLabelValues=localCity

The preferredLabelValues parameter can be used to return a more suitable city name for this address in reverse geocoding results. Pass preferredLabelValues=localCity in the reverseGeocode request to return Eagan as the city name in the output.

Use dark colors for code blocksCopy
1
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?f=pjson&featureTypes=PointAddress&preferredLabelValues=localCity&location=-93.13726,44.803809&token=<ACCESS_TOKEN>

Specify output fields

The reverseGeocode operation allows you to specify individual output fields or return all output fields. The outFields parameter is used for this. If you want to return all supported output fields, set outFields=* , or exclude the parameter from the request. By default, all output fields are returned for a reverseGeocode request, so passing outFields=* or outFields= (blank) in the request, or excluding it altogether, produces the same results.

Specify a subset of output fields for a PointAddress

Use dark colors for code blocksCopy
1
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?f=pjson&location=4.937714,52.363908&featureTypes=PointAddress&outFields=LongLabel,Addr_type,CountryCode&token=<ACCESS_TOKEN>

Return all output fields for a PointAddress

Use dark colors for code blocksCopy
1
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?f=pjson&location=4.937714,52.363908&featureTypes=PointAddress&outFields=*&token=<ACCESS_TOKEN>

Use input coordinates for output location

For some applications it may be useful to display the location of the input X/Y coordinates which were submitted in a reverseGeocode request as a point on a map. The returnInputLocation parameter is used for this.

Specify the input coordinates as the output location

Use dark colors for code blocksCopy
1
GET https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?f=pjson&returnInputLocation=true&location=-117.1959,34.0561&token=<ACCESS_TOKEN>

Notice that the location object x and y values are the same as the InputX and InputY fields. This is because returnInputLocation=true was used in the request.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.