Reverse geocoding - Amazon Location Service

Reverse geocoding

Reverse geocoding is a process that converts a set of coordinates into meaningful text, such as an address, a region, a business name, or point of interest. You can use place index resources to submit reverse geocoding requests and incorporate data retrieved from reverse geocoding to display data on a map for your web or mobile application.

This section guides you through how to send a simple reverse geocoding request.

Reverse gocoding

You can submit a simple request to reverse geocode a set of coordinates and convert them to a meaningful address, a point of interest or a general location without an address using the SearchPlaceIndexForPosition operation. A simple request contains the following required parameter:

  • Position – A set of coordinates that you want to convert to an address, point of interest, or general location. Defined using the format [longitude,latitude].

If you want to specify a maximum number of results per pages, use the following optional parameter:

  • MaxResults – Limits the maximum number of results returned per page.

You can use the AWS CLI or the Amazon Location APIs.

API

The following example is a SearchPlaceIndexForPosition request to search the place index resource, ExamplePlaceIndex, for a meaningful address, point of interest or general location near the position [122.3394,47.6159].

POST /places/v0/indexes/ExamplePlaceIndex/search/position Content-type: application/json { "Position": [-122.3394,47.6159], "MaxResults": 5 }
AWS CLI

The following example is a search-place-index-for-position command to search the place index resource, ExamplePlaceIndex, for a meaningful address, point of interest or general location near the position [122.3394,47.6159].

aws location \ search-place-index-for-position \ --index-name ExamplePlaceIndex \ --position [-122.3394,47.6159] \ --max-results 5

Example response

The following is an example response when calling the SearchPlaceIndexForPosition operation from the Amazon Location Places APIs. The results returns relevant places and the request summary.

Example request
POST /places/v0/indexes/ExamplePlaceIndex/search/position Content-type: application/json { "Position": [-122.3394,47.6159], "MaxResults": 1 }
Example response
{ "Results": [ { "Place": { "AddressNumber": "2111", "Country": "USA", "Geometry": { "Point": [ -122.33937999999995, 47.61591000000004 ] }, "Label": "The Spheres, 2111 7th Ave, Seattle, WA, 98121, USA", "Municipality": "Seattle", "Neighborhood": "Belltown", "PostalCode": "98121", "Region": "Washington", "SubRegion": "King County" } } ], "Summary": { "DataSource": "Esri", "MaxResults": 1, "Position": [ -122.3394, 47.6159 ] } }