Search - Get Geocoding

Use to get longitude and latitude coordinates of a street address or name of a place.

The Get Geocoding API is an HTTP GET request that returns the longitude and latitude coordinates of the location being searched.

In many cases, the complete search service might be too much, for instance if you are only interested in traditional geocoding. Search can also be accessed for address look up exclusively. The geocoding is performed by hitting the geocoding endpoint with just the address or partial address in question. The geocoding search index will be queried for everything above the street level data. No Point of Interest (POIs) will be returned. Note that the geocoder is very tolerant of typos and incomplete addresses. It will also handle everything from exact street addresses or street or intersections as well as higher level geographies such as city centers, counties and states. The response also returns detailed address properties such as street, postal code, municipality, and country/region information.

GET https://atlas.microsoft.com/geocode?api-version=2023-06-01
GET https://atlas.microsoft.com/geocode?api-version=2023-06-01&top={top}&query={query}&addressLine={addressLine}&countryRegion={countryRegion}&bbox={bbox}&view={view}&coordinates={coordinates}&adminDistrict={adminDistrict}&adminDistrict2={adminDistrict2}&adminDistrict3={adminDistrict3}&locality={locality}&postalCode={postalCode}

URI Parameters

Name In Required Type Description
api-version
query True

string

Version number of Azure Maps API.

addressLine
query

string

The official street line of an address relative to the area, as specified by the locality, or postalCode, properties. Typical use of this element would be to provide a street address or any official address.

If query is given, should not use this parameter.

adminDistrict
query

string

The country subdivision portion of an address, such as WA.

If query is given, should not use this parameter.

adminDistrict2
query

string

The county for the structured address, such as King.

If query is given, should not use this parameter.

adminDistrict3
query

string

The named area for the structured address.

If query is given, should not use this parameter.

bbox
query

number[]

A rectangular area on the earth defined as a bounding box object. The sides of the rectangles are defined by longitude and latitude values. When you specify this parameter, the geographical area is taken into account when computing the results of a location query.

Example: lon1,lat1,lon2,lat2

coordinates
query

number[]

A point on the earth specified as a longitude and latitude. When you specify this parameter, the user’s location is taken into account and the results returned may be more relevant to the user. Example: &coordinates=lon,lat

countryRegion
query

string

Signal for the geocoding result to an ISO 3166-1 Alpha-2 region/country code that is specified e.g. FR./

If query is given, should not use this parameter.

locality
query

string

The locality portion of an address, such as Seattle.

If query is given, should not use this parameter.

postalCode
query

string

The postal code portion of an address.

If query is given, should not use this parameter.

query
query

string

A string that contains information about a location, such as an address or landmark name.

top
query

integer

int32

Maximum number of responses that will be returned. Default: 5, minimum: 1 and maximum: 20.

view
query

string

A string that represents an ISO 3166-1 Alpha-2 region/country code. This will alter Geopolitical disputed borders and labels to align with the specified user region. By default, the View parameter is set to “Auto” even if you haven’t defined it in the request.

Please refer to Supported Views for details and to see the available Views.

Request Header

Name Required Type Description
Accept-Language

string

Language in which search results should be returned.

Please refer to Supported Languages for details.

x-ms-client-id

string

Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following articles for guidance.

Responses

Name Type Description
200 OK

GeocodingResponse

OK

Media Types: "application/geo+json"

Headers

x-ms-request-id: string

Other Status Codes

ErrorResponse

An unexpected error occurred.

Media Types: "application/geo+json"

Security

AADToken

These are the Microsoft Entra OAuth 2.0 Flows. When paired with Azure role-based access control it can be used to control access to Azure Maps REST APIs. Azure role-based access controls are used to designate access to one or more Azure Maps resource account or sub-resources. Any user, group, or service principal can be granted access via a built-in role or a custom role composed of one or more permissions to Azure Maps REST APIs.

To implement scenarios, we recommend viewing authentication concepts. In summary, this security definition provides a solution for modeling application(s) via objects capable of access control on specific APIs and scopes.

Note

  • This security definition requires the use of the x-ms-client-id header to indicate which Azure Maps resource the application is requesting access to. This can be acquired from the Maps management API.
  • The Authorization URL is specific to the Azure public cloud instance. Sovereign clouds have unique Authorization URLs and Microsoft Entra ID configurations.
  • The Azure role-based access control is configured from the Azure management plane via Azure portal, PowerShell, CLI, Azure SDKs, or REST APIs.
  • Usage of the Azure Maps Web SDK allows for configuration based setup of an application for multiple use cases.
  • For more information on Microsoft identity platform, see Microsoft identity platform overview.

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
https://atlas.microsoft.com/.default https://atlas.microsoft.com/.default

subscription-key

This is a shared key that is provisioned when creating an Azure Maps resource through the Azure management plane via Azure portal, PowerShell, CLI, Azure SDKs, or REST APIs.

With this key, any application is authorized to access all REST APIs. In other words, these can currently be treated as master keys to the account which they are issued for.

For publicly exposed applications, our recommendation is to use server-to-server access of Azure Maps REST APIs where this key can be securely stored.

Type: apiKey
In: header

SAS Token

This is a shared access signature token is created from the List SAS operation on the Azure Maps resource through the Azure management plane via Azure portal, PowerShell, CLI, Azure SDKs, or REST APIs.

With this token, any application is authorized to access with Azure role-based access controls and fine-grain control to the expiration, rate, and region(s) of use for the particular token. In other words, the SAS Token can be used to allow applications to control access in a more secured way than the shared key.

For publicly exposed applications, our recommendation is to configure a specific list of allowed origins on the Map account resource to limit rendering abuse and regularly renew the SAS Token.

Type: apiKey
In: header

Examples

Search detail address 15127 NE 24th Street, Redmond, WA
Search detail address 15127 NE 24th Street, Redmond, WA by addressLine
Search detail address 15127 NE 24th Street, Redmond, WA by query
Search landmark Empire State Building by query

Search detail address 15127 NE 24th Street, Redmond, WA

Sample request

GET https://atlas.microsoft.com/geocode?api-version=2023-06-01&addressLine=15127 NE 24th Street&adminDistrict=WA&locality=Redmond

Sample response

Content-Type: application/geo+json
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "address": {
          "countryRegion": {
            "name": "United States"
          },
          "adminDistricts": [
            {
              "shortName": "WA"
            },
            {
              "shortName": "King County"
            }
          ],
          "formattedAddress": "15127 NE 24th St, Redmond, WA 98052",
          "locality": "Redmond",
          "postalCode": "98052",
          "addressLine": "15127 NE 24th St"
        },
        "type": "Address",
        "confidence": "High",
        "matchCodes": [
          "Good"
        ],
        "geocodePoints": [
          {
            "geometry": {
              "type": "Point",
              "coordinates": [
                -122.138681,
                47.630358
              ]
            },
            "calculationMethod": "Rooftop",
            "usageTypes": [
              "Display"
            ]
          },
          {
            "geometry": {
              "type": "Point",
              "coordinates": [
                -122.1386787,
                47.6302179
              ]
            },
            "calculationMethod": "Rooftop",
            "usageTypes": [
              "Route"
            ]
          }
        ]
      },
      "geometry": {
        "type": "Point",
        "coordinates": [
          -122.138681,
          47.630358
        ]
      },
      "bbox": [
        -122.14632282407,
        47.626495282429325,
        -122.13103917593001,
        47.63422071757068
      ]
    }
  ]
}

Search detail address 15127 NE 24th Street, Redmond, WA by addressLine

Sample request

GET https://atlas.microsoft.com/geocode?api-version=2023-06-01&addressLine=15127 NE 24th Street Redmond WA&countryRegion=US

Sample response

Content-Type: application/geo+json
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "address": {
          "countryRegion": {
            "name": "United States"
          },
          "adminDistricts": [
            {
              "shortName": "WA"
            },
            {
              "shortName": "King County"
            }
          ],
          "formattedAddress": "15127 NE 24th St, Redmond, WA 98052",
          "locality": "Redmond",
          "postalCode": "98052",
          "addressLine": "15127 NE 24th St"
        },
        "type": "Address",
        "confidence": "Medium",
        "matchCodes": [
          "Good"
        ],
        "geocodePoints": [
          {
            "geometry": {
              "type": "Point",
              "coordinates": [
                -122.138681,
                47.630358
              ]
            },
            "calculationMethod": "Rooftop",
            "usageTypes": [
              "Display"
            ]
          },
          {
            "geometry": {
              "type": "Point",
              "coordinates": [
                -122.1386787,
                47.6302179
              ]
            },
            "calculationMethod": "Rooftop",
            "usageTypes": [
              "Route"
            ]
          }
        ]
      },
      "geometry": {
        "type": "Point",
        "coordinates": [
          -122.138681,
          47.630358
        ]
      },
      "bbox": [
        -122.14632282407,
        47.626495282429325,
        -122.13103917593001,
        47.63422071757068
      ]
    }
  ]
}

Search detail address 15127 NE 24th Street, Redmond, WA by query

Sample request

GET https://atlas.microsoft.com/geocode?api-version=2023-06-01&query=15127 NE 24th Street Redmond WA

Sample response

Content-Type: application/geo+json
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "address": {
          "countryRegion": {
            "name": "United States"
          },
          "adminDistricts": [
            {
              "shortName": "WA"
            },
            {
              "shortName": "King County"
            }
          ],
          "formattedAddress": "15127 NE 24th St, Redmond, WA 98052",
          "locality": "Redmond",
          "postalCode": "98052",
          "addressLine": "15127 NE 24th St"
        },
        "type": "Address",
        "confidence": "High",
        "matchCodes": [
          "Good"
        ],
        "geocodePoints": [
          {
            "geometry": {
              "type": "Point",
              "coordinates": [
                -122.138681,
                47.630358
              ]
            },
            "calculationMethod": "Rooftop",
            "usageTypes": [
              "Display"
            ]
          },
          {
            "geometry": {
              "type": "Point",
              "coordinates": [
                -122.1386787,
                47.6302179
              ]
            },
            "calculationMethod": "Rooftop",
            "usageTypes": [
              "Route"
            ]
          }
        ]
      },
      "geometry": {
        "type": "Point",
        "coordinates": [
          -122.138681,
          47.630358
        ]
      },
      "bbox": [
        -122.14632282407,
        47.626495282429325,
        -122.13103917593001,
        47.63422071757068
      ]
    }
  ]
}

Search landmark Empire State Building by query

Sample request

GET https://atlas.microsoft.com/geocode?api-version=2023-06-01&query=empire state building

Sample response

Content-Type: application/geo+json
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "address": {
          "countryRegion": {
            "name": "United States"
          },
          "adminDistricts": [
            {
              "shortName": "NY"
            }
          ],
          "formattedAddress": "Empire State Building, NY",
          "locality": "New York"
        },
        "type": "PointOfInterest",
        "confidence": "High",
        "matchCodes": [
          "Ambiguous"
        ],
        "geocodePoints": [
          {
            "geometry": {
              "type": "Point",
              "coordinates": [
                -73.98580932617188,
                40.748435974121094
              ]
            },
            "calculationMethod": "Rooftop",
            "usageTypes": [
              "Display"
            ]
          }
        ]
      },
      "geometry": {
        "type": "Point",
        "coordinates": [
          -73.98580932617188,
          40.748435974121094
        ]
      },
      "bbox": [
        -73.98590850830078,
        40.74833679199219,
        -73.98571014404297,
        40.74853515625
      ]
    },
    {
      "type": "Feature",
      "properties": {
        "address": {
          "countryRegion": {
            "name": "United States"
          },
          "adminDistricts": [
            {
              "shortName": "NY"
            },
            {
              "shortName": "New York County"
            }
          ],
          "formattedAddress": "Empire State Building, NY",
          "locality": "Manhattan"
        },
        "type": "LandmarkBuilding",
        "confidence": "High",
        "matchCodes": [
          "Ambiguous"
        ],
        "geocodePoints": [
          {
            "geometry": {
              "type": "Point",
              "coordinates": [
                -73.98500061035156,
                40.74815368652344
              ]
            },
            "calculationMethod": "Rooftop",
            "usageTypes": [
              "Display"
            ]
          }
        ]
      },
      "geometry": {
        "type": "Point",
        "coordinates": [
          -73.98500061035156,
          40.74815368652344
        ]
      },
      "bbox": [
        -73.98710632324219,
        40.747314453125,
        -73.98412322998047,
        40.74958038330078
      ]
    }
  ]
}

Definitions

Name Description
Address

The address of the result

AdminDistricts

The subdivision name in the country or region for an address. This element is typically treated as the first order administrative subdivision, but in some cases it also contains the second, third, or fourth order subdivision in a country, dependency, or region.

CalculationMethodEnum

The method that was used to compute the geocode point.

ConfidenceEnum

The level of confidence that the geocoded location result is a match. Use this value with the match code to determine for more complete information about the match.

The confidence of a geocoded location is based on many factors including the relative importance of the geocoded location and the user’s location, if specified.

CountryRegion
ErrorAdditionalInfo

The resource management error additional info.

ErrorDetail

The error detail.

ErrorResponse

Error response

FeatureCollectionEnum

The type of a FeatureCollection object must be FeatureCollection.

FeaturesItem
FeatureTypeEnum

The type of a feature must be Feature.

GeocodePoints

A collection of geocode points that differ in how they were calculated and their suggested use.

GeocodingResponse

This object is returned from a successful Geocoding call

GeoJsonPoint

A valid GeoJSON Point geometry type. Please refer to RFC 7946 for details.

Intersection

The address of the result.

MatchCodesEnum

One or more match code values that represent the geocoding level for each location in the response.

For example, a geocoded location with match codes of Good and Ambiguous means that more than one geocode location was found for the location information and that the geocode service did not have search up-hierarchy to find a match.

Similarly, a geocoded location with match codes of Ambiguous and UpHierarchy implies that a geocode location could not be found that matched all the provided location information, so the geocode service had to search up-hierarchy and found multiple matches at that level. An example of up an Ambiguous and UpHierarchy result is when you provide complete address information, but the geocode service cannot locate a match for the street address and instead returns information for more than one RoadBlock value.

The possible values are:

Good: The location has only one match or all returned matches are considered strong matches. For example, a query for New York returns several Good matches.

Ambiguous: The location is one of a set of possible matches. For example, when you query for the street address 128 Main St., the response may return two locations for 128 North Main St. and 128 South Main St. because there is not enough information to determine which option to choose.

UpHierarchy: The location represents a move up the geographic hierarchy. This occurs when a match for the location request was not found, so a less precise result is returned. For example, if a match for the requested address cannot be found, then a match code of UpHierarchy with a RoadBlock entity type may be returned.

Properties
UsageTypeEnum

The best use for the geocode point. Each geocode point is defined as a Route point, a Display point or both. Use Route points if you are creating a route to the location. Use Display points if you are showing the location on a map. For example, if the location is a park, a Route point may specify an entrance to the park where you can enter with a car, and a Display point may be a point that specifies the center of the park.

Address

The address of the result

Name Type Description
addressLine

string

AddressLine that includes Street Name and Number

adminDistricts

AdminDistricts[]

The subdivision name in the country or region for an address. This element is typically treated as the first order administrative subdivision, but in some cases it also contains the second, third, or fourth order subdivision in a country, dependency, or region.

countryRegion

CountryRegion

formattedAddress

string

Formatted Address property

intersection

Intersection

The address of the result.

locality

string

locality property

neighborhood

string

neighborhood property

postalCode

string

Postal Code property

AdminDistricts

The subdivision name in the country or region for an address. This element is typically treated as the first order administrative subdivision, but in some cases it also contains the second, third, or fourth order subdivision in a country, dependency, or region.

Name Type Description
name

string

The name for the corresponding adminDistrict field, For adminDistrict[0], this could be full name of state such as Washington, For adminDistrict[1], this could be the full name of the county

shortName

string

The short name for the corresponding adminDistrict field, For adminDistrict[0], this could be short name of state such as WA, For adminDistrict[1], this could be the short name of the county

CalculationMethodEnum

The method that was used to compute the geocode point.

Name Type Description
Interpolation

string

The geocode point was matched to a point on a road using interpolation.

InterpolationOffset

string

The geocode point was matched to a point on a road using interpolation with an additional offset to shift the point to the side of the street.

Parcel

string

The geocode point was matched to the center of a parcel.

Rooftop

string

The geocode point was matched to the rooftop of a building.

ConfidenceEnum

The level of confidence that the geocoded location result is a match. Use this value with the match code to determine for more complete information about the match.

The confidence of a geocoded location is based on many factors including the relative importance of the geocoded location and the user’s location, if specified.

Name Type Description
High

string

If the confidence is set to High, one or more strong matches were found. Multiple High confidence matches are sorted in ranked order by importance when applicable. For example, landmarks have importance but addresses do not.

If a request includes a location or a view, then the ranking may change appropriately. For example, a location query for "Paris" returns "Paris, France" and "Paris, TX" both with High confidence. "Paris, France" is always ranked first due to importance unless a user location indicates that the user is in or very close to Paris, TX or the map view indicates that the user is searching in that area.

Low

string

Medium

string

In some situations, the returned match may not be at the same level as the information provided in the request. For example, a request may specify address information and the geocode service may only be able to match a postal code. In this case, if the geocode service has a confidence that the postal code matches the data, the confidence is set to Medium and the match code is set to UpHierarchy to specify that it could not match all of the information and had to search up-hierarchy.

If the location information in the query is ambiguous, and there is no additional information to rank the locations (such as user location or the relative importance of the location), the confidence is set to Medium. For example, a location query for "148th Ave, Bellevue" may return "148th Ave SE" and "148th Ave NE" both with Medium confidence.

If the location information in the query does not provide enough information to geocode a specific location, a less precise location value may be returned and the confidence is set to Medium. For example, if an address is provided, but a match is not found for the house number, the geocode result with a Roadblock entity type may be returned.

CountryRegion

Name Type Description
ISO

string

ISO of country/region

name

string

name of country/region

ErrorAdditionalInfo

The resource management error additional info.

Name Type Description
info

object

The additional info.

type

string

The additional info type.

ErrorDetail

The error detail.

Name Type Description
additionalInfo

ErrorAdditionalInfo[]

The error additional info.

code

string

The error code.

details

ErrorDetail[]

The error details.

message

string

The error message.

target

string

The error target.

ErrorResponse

Error response

Name Type Description
error

ErrorDetail

The error object.

FeatureCollectionEnum

The type of a FeatureCollection object must be FeatureCollection.

Name Type Description
FeatureCollection

string

FeaturesItem

Name Type Description
bbox

number[]

Bounding box. Projection used - EPSG:3857. Please refer to RFC 7946 for details.

geometry

GeoJsonPoint

A valid GeoJSON Point geometry type. Please refer to RFC 7946 for details.

id

string

ID for feature returned

properties

Properties

type

FeatureTypeEnum

The type of a feature must be Feature.

FeatureTypeEnum

The type of a feature must be Feature.

Name Type Description
Feature

string

GeocodePoints

A collection of geocode points that differ in how they were calculated and their suggested use.

Name Type Description
calculationMethod

CalculationMethodEnum

The method that was used to compute the geocode point.

geometry

GeoJsonPoint

A valid GeoJSON Point geometry type. Please refer to RFC 7946 for details.

usageTypes

UsageTypeEnum[]

The best use for the geocode point. Each geocode point is defined as a Route point, a Display point or both. Use Route points if you are creating a route to the location. Use Display points if you are showing the location on a map. For example, if the location is a park, a Route point may specify an entrance to the park where you can enter with a car, and a Display point may be a point that specifies the center of the park.

GeocodingResponse

This object is returned from a successful Geocoding call

Name Type Description
features

FeaturesItem[]

nextLink

string

The is the link to the next page of the features returned. If it's the last page, no this field.

type

FeatureCollectionEnum

The type of a FeatureCollection object must be FeatureCollection.

GeoJsonPoint

A valid GeoJSON Point geometry type. Please refer to RFC 7946 for details.

Name Type Description
bbox

number[]

Bounding box. Projection used - EPSG:3857. Please refer to RFC 7946 for details.

coordinates

number[]

A Position is an array of numbers with two or more elements. The first two elements are longitude and latitude, precisely in that order. Altitude/Elevation is an optional third element. Please refer to RFC 7946 for details.

type string:

Point

Specifies the GeoJSON type. Must be one of the nine valid GeoJSON object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, GeometryCollection, Feature and FeatureCollection.

Intersection

The address of the result.

Name Type Description
baseStreet

string

Primary street for the location.

displayName

string

Complete name of the intersection.

intersectionType

string

Type of intersection.

secondaryStreet1

string

The first intersecting street.

secondaryStreet2

string

If any, the second intersecting street.

MatchCodesEnum

One or more match code values that represent the geocoding level for each location in the response.

For example, a geocoded location with match codes of Good and Ambiguous means that more than one geocode location was found for the location information and that the geocode service did not have search up-hierarchy to find a match.

Similarly, a geocoded location with match codes of Ambiguous and UpHierarchy implies that a geocode location could not be found that matched all the provided location information, so the geocode service had to search up-hierarchy and found multiple matches at that level. An example of up an Ambiguous and UpHierarchy result is when you provide complete address information, but the geocode service cannot locate a match for the street address and instead returns information for more than one RoadBlock value.

The possible values are:

Good: The location has only one match or all returned matches are considered strong matches. For example, a query for New York returns several Good matches.

Ambiguous: The location is one of a set of possible matches. For example, when you query for the street address 128 Main St., the response may return two locations for 128 North Main St. and 128 South Main St. because there is not enough information to determine which option to choose.

UpHierarchy: The location represents a move up the geographic hierarchy. This occurs when a match for the location request was not found, so a less precise result is returned. For example, if a match for the requested address cannot be found, then a match code of UpHierarchy with a RoadBlock entity type may be returned.

Name Type Description
Ambiguous

string

Good

string

UpHierarchy

string

Properties

Name Type Description
address

Address

The address of the result

confidence

ConfidenceEnum

The level of confidence that the geocoded location result is a match. Use this value with the match code to determine for more complete information about the match.

The confidence of a geocoded location is based on many factors including the relative importance of the geocoded location and the user’s location, if specified.

geocodePoints

GeocodePoints[]

A collection of geocode points that differ in how they were calculated and their suggested use.

matchCodes

MatchCodesEnum[]

One or more match code values that represent the geocoding level for each location in the response.

For example, a geocoded location with match codes of Good and Ambiguous means that more than one geocode location was found for the location information and that the geocode service did not have search up-hierarchy to find a match.

Similarly, a geocoded location with match codes of Ambiguous and UpHierarchy implies that a geocode location could not be found that matched all the provided location information, so the geocode service had to search up-hierarchy and found multiple matches at that level. An example of up an Ambiguous and UpHierarchy result is when you provide complete address information, but the geocode service cannot locate a match for the street address and instead returns information for more than one RoadBlock value.

The possible values are:

Good: The location has only one match or all returned matches are considered strong matches. For example, a query for New York returns several Good matches.

Ambiguous: The location is one of a set of possible matches. For example, when you query for the street address 128 Main St., the response may return two locations for 128 North Main St. and 128 South Main St. because there is not enough information to determine which option to choose.

UpHierarchy: The location represents a move up the geographic hierarchy. This occurs when a match for the location request was not found, so a less precise result is returned. For example, if a match for the requested address cannot be found, then a match code of UpHierarchy with a RoadBlock entity type may be returned.

type

string

One of:

  • Address
  • RoadBlock
  • RoadIntersection
  • Neighborhood
  • PopulatedPlace
  • Postcode1
  • AdminDivision1
  • AdminDivision2
  • CountryRegion

UsageTypeEnum

The best use for the geocode point. Each geocode point is defined as a Route point, a Display point or both. Use Route points if you are creating a route to the location. Use Display points if you are showing the location on a map. For example, if the location is a park, a Route point may specify an entrance to the park where you can enter with a car, and a Display point may be a point that specifies the center of the park.

Name Type Description
Display

string

Route

string