Prerequisites
Before you begin geocoding, reverse geocoding or searching for places, follow the prerequisite steps:
Create a place index resource
Begin by creating a place index resource in your AWS account.
When you create a place index resource, you can choose from the data providers available to support queries for geocoding, reverse geocoding, and searches:
-
Esri – For more information about Esri's coverage in your region of interest, see Esri geocoding coverage
in this guide. -
HERE Technologies – For more information about HERE's coverage in your region of interest, see HERE geocoding coverage
in this guide.
You can do this using the Amazon Location Service console, the AWS CLI, or the Amazon Location APIs.
Billing depends on your usage. You may incur fees for the use of other AWS
services. For more information, see Amazon Location Service
pricing
Authenticating your requests
Once you create a place index resource and you're ready to begin building location features into your application, choose how you would authenticate your requests:
-
To explore ways you can access the services, see Accessing Amazon Location Service.
-
If you have a website with anonymous users, or you want to use your own authentication process, or combine multiple authentication methods, see Allowing unauthenticated guest access to your application using Amazon Cognito.
Example
The following example shows the passing of the unauthenticated identity pool as credentials when using the AWS JavaScript SDK
. const AWS = require("aws-sdk"); const credentials = new AWS.CognitoIdentityCredentials({ IdentityPoolId: "
us-east-1:54f2ba88-9390-498d-aaa5-0d97fb7ca3bd
" }); const client = new AWS.Location({ credentials, region: AWS.config.region // region containing the identity pool }); // rsp.Results contains search results for geocoding const rsp = await location.searchPlaceIndexForText({ IndexName: "ExamplePlaceIndex
", Text: "Anyplace", BiasPosition: [-123.4567, 45.6789] }).promise();