ReverseGeocodeCommand

The ReverseGeocode operation allows you to retrieve addresses and place information from coordinates.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { GeoPlacesClient, ReverseGeocodeCommand } from "@aws-sdk/client-geo-places"; // ES Modules import
// const { GeoPlacesClient, ReverseGeocodeCommand } = require("@aws-sdk/client-geo-places"); // CommonJS import
const client = new GeoPlacesClient(config);
const input = { // ReverseGeocodeRequest
  QueryPosition: [ // Position // required
    Number("double"),
  ],
  QueryRadius: Number("long"),
  MaxResults: Number("int"),
  Filter: { // ReverseGeocodeFilter
    IncludePlaceTypes: [ // ReverseGeocodeFilterPlaceTypeList
      "STRING_VALUE",
    ],
  },
  AdditionalFeatures: [ // ReverseGeocodeAdditionalFeatureList
    "STRING_VALUE",
  ],
  Language: "STRING_VALUE",
  PoliticalView: "STRING_VALUE",
  IntendedUse: "STRING_VALUE",
  Key: "STRING_VALUE",
};
const command = new ReverseGeocodeCommand(input);
const response = await client.send(command);
// { // ReverseGeocodeResponse
//   PricingBucket: "STRING_VALUE", // required
//   ResultItems: [ // ReverseGeocodeResultItemList
//     { // ReverseGeocodeResultItem
//       PlaceId: "STRING_VALUE", // required
//       PlaceType: "STRING_VALUE", // required
//       Title: "STRING_VALUE", // required
//       Address: { // Address
//         Label: "STRING_VALUE",
//         Country: { // Country
//           Code2: "STRING_VALUE",
//           Code3: "STRING_VALUE",
//           Name: "STRING_VALUE",
//         },
//         Region: { // Region
//           Code: "STRING_VALUE",
//           Name: "STRING_VALUE",
//         },
//         SubRegion: { // SubRegion
//           Code: "STRING_VALUE",
//           Name: "STRING_VALUE",
//         },
//         Locality: "STRING_VALUE",
//         District: "STRING_VALUE",
//         SubDistrict: "STRING_VALUE",
//         PostalCode: "STRING_VALUE",
//         Block: "STRING_VALUE",
//         SubBlock: "STRING_VALUE",
//         Intersection: [ // IntersectionList
//           "STRING_VALUE",
//         ],
//         Street: "STRING_VALUE",
//         StreetComponents: [ // StreetComponentsList
//           { // StreetComponents
//             BaseName: "STRING_VALUE",
//             Type: "STRING_VALUE",
//             TypePlacement: "STRING_VALUE",
//             TypeSeparator: "STRING_VALUE",
//             Prefix: "STRING_VALUE",
//             Suffix: "STRING_VALUE",
//             Direction: "STRING_VALUE",
//             Language: "STRING_VALUE",
//           },
//         ],
//         AddressNumber: "STRING_VALUE",
//         Building: "STRING_VALUE",
//       },
//       AddressNumberCorrected: true || false,
//       PostalCodeDetails: [ // PostalCodeDetailsList
//         { // PostalCodeDetails
//           PostalCode: "STRING_VALUE",
//           PostalAuthority: "STRING_VALUE",
//           PostalCodeType: "STRING_VALUE",
//           UspsZip: { // UspsZip
//             ZipClassificationCode: "STRING_VALUE",
//           },
//           UspsZipPlus4: { // UspsZipPlus4
//             RecordTypeCode: "STRING_VALUE",
//           },
//         },
//       ],
//       Position: [ // Position
//         Number("double"),
//       ],
//       Distance: Number("long"),
//       MapView: [ // BoundingBox
//         Number("double"),
//       ],
//       Categories: [ // CategoryList
//         { // Category
//           Id: "STRING_VALUE", // required
//           Name: "STRING_VALUE", // required
//           LocalizedName: "STRING_VALUE",
//           Primary: true || false,
//         },
//       ],
//       FoodTypes: [ // FoodTypeList
//         { // FoodType
//           LocalizedName: "STRING_VALUE", // required
//           Id: "STRING_VALUE",
//           Primary: true || false,
//         },
//       ],
//       AccessPoints: [ // AccessPointList
//         { // AccessPoint
//           Position: [
//             Number("double"),
//           ],
//         },
//       ],
//       TimeZone: { // TimeZone
//         Name: "STRING_VALUE", // required
//         Offset: "STRING_VALUE",
//         OffsetSeconds: Number("long"),
//       },
//       PoliticalView: "STRING_VALUE",
//     },
//   ],
// };

ReverseGeocodeCommand Input

See ReverseGeocodeCommandInput for more details

Parameter
Type
Description
QueryPosition
Required
number[] | undefined

The position, in [lng, lat] for which you are querying nearby resultsfor. Results closer to the position will be ranked higher then results further away from the position

AdditionalFeatures
ReverseGeocodeAdditionalFeature[] | undefined

A list of optional additional parameters, such as time zone that can be requested for each result.

Filter
ReverseGeocodeFilter | undefined

A structure which contains a set of inclusion/exclusion properties that results must posses in order to be returned as a result.

IntendedUse
ReverseGeocodeIntendedUse | undefined

Indicates if the results will be stored. Defaults to SingleUse, if left empty.

Key
string | undefined

Optional: The API key to be used for authorization. Either an API key or valid SigV4 signature must be provided when making a request.

Language
string | undefined

A list of BCP 47  compliant language codes for the results to be rendered in. If there is no data for the result in the requested language, data will be returned in the default language for the entry.

MaxResults
number | undefined

An optional limit for the number of results returned in a single call.

PoliticalView
string | undefined

The alpha-2 or alpha-3 character code for the political view of a country. The political view applies to the results of the request to represent unresolved territorial claims through the point of view of the specified country.

QueryRadius
number | undefined

The maximum distance in meters from the QueryPosition from which a result will be returned.

ReverseGeocodeCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
PricingBucket
Required
string | undefined

The pricing bucket for which the query is charged at.

For more inforamtion on pricing, please visit Amazon Location Service Pricing .

ResultItems
ReverseGeocodeResultItem[] | undefined

List of places or results returned for a query.

Throws

Name
Fault
Details
AccessDeniedException
client

You don't have sufficient access to perform this action.

InternalServerException
server

The request processing has failed because of an unknown error, exception or failure.

ThrottlingException
client

The request was denied due to request throttling.

ValidationException
client

The input fails to satisfy the constraints specified by an AWS service.

GeoPlacesServiceException
Base exception class for all service exceptions from GeoPlaces service.