Skip to main content
APIs 11 min read

HERE Geocoding and Search on Amazon Location Service

Reverse Geocode

HERE provides Amazon Location Service with map rendering, geocoding, search, and routing, with global coverage and local flavor that transect geographic borders. Last week, we discussed HERE Maps on Amazon Location Service. In this blog, we will discuss the Places feature in Amazon Location Service using high-quality geospatial data from HERE Technologies. 

Amazon Location Service Places enables your application to offer point-of-interest search functionality, convert addresses into geographic coordinates in latitude and longitude (geocoding), and convert a coordinate into a street address (reverse geocoding). HERE’s data comes with a high level of quality, flexibility, functionality, and enables critical use cases with precision and relevancy at its core. One of the use cases is to verify customer addresses, it helps to complete address entries quicker, and use geocoding and reverse geocoding to verify and standardize customer addresses.

HERE services include a set of features that give access to location context, inclusive of administrative and postal code boundary shapes, point addressing, high-precision postal codes, match quality levels, and more. While leveraging a robust geocoding engine, it gives access to places geocoding capability which allows for HERE’s vast database of POIs to be recognized in geocoding queries, enabling more relevant and meaningful results. 

HERE Geocoding and Search Capabilities
Geocoding
  • Free form, structured and hybrid address input
  • 400 million point addresses in over 102 countries and territories
  • 270 million hyper-precise point addresses in over 70 countries
  • Administrative and postal code boundary shapes 
  • High-precision postal codes (US, Great Britain and Republic of Ireland)
  • Places geocoding with integrated POI information in queries
Reverse geocoding
  • Address retrieval for the nearest street addresses including long-haul roads (e.g., freeways, interstates) and entry points
  • Area retrieval for administrative area information for given position (latitude/longitude)
One box search/discovery
  • Support for multiple query types input 
  • Querying by: place names, addresses (partial and complete, including postal codes), chains, categories, postal codes.

For the purpose of showcasing and exploring the capabilities of HERE Geocoding and Search in Amazon Location Service, we have created a demo application below that uses MapLibre GL JS, Amazon Location Service, and AWS Amplify. This application is extended and modified from this Amazon Location sample. In this application, you can click anywhere on the map, and then it would reverse geocode the given location coordinate to return a legible address.

Now let's look at how we built and customized this demo application.

  • We created a place index resource and identity pool for authentication in the Amazon Location Service console as prerequisites before we begin geocoding, reverse geocoding, or searching for places.
aws place index resource
  • We used the place index resource that we just created in SearchPlaceIndexForPosition function to do reserve geocoding. We used an optional parameter "Language" to show a localize address result in the HERE Explore map that are in Japan. 
Copied
        // AWS Resources
// Cognito:
const identityPoolId = "eu-central-1:ad58ed2f-b77f-4537-9559-xxxxxxx";

// Extract the region from the Identity Pool ID
AWS.config.region = identityPoolId.split(":")[0];

// Instantiate a Cognito-backed credential provider
const credentials = new AWS.CognitoIdentityCredentials({
  IdentityPoolId: identityPoolId,
});

async function main() {
  const location = new AWS.Location({credentials, region: AWS.config.region});

  // On mouse click, display marker and get results:
  map.on("click", function(e) {

    // Set up parameters for search call
    let params = {
      IndexName: "explore.place.here",
      Position: [e.lngLat.lng, e.lngLat.lat],
      Language: "ja",
      MaxResults: "2"
    };

    // Search for results around clicked point
    location.searchPlaceIndexForPosition(params, function(err, data) {
      if (err) {
        //...error handling
      } else {
        // Write JSON response data to HTML
        document.querySelector("#response").textContent = JSON.stringify(data, undefined, 2);
      }
    });
  });
}
  
  • And below is the reverse geocoding response to show legible addresses near the given location coordinate. 
Copied
        {
  "Results": [
    {
      "Distance": 3.403568961062917,
      "Place": {
        "AddressNumber": "7",
        "Country": "JPN",
        "Geometry": {
          "Point": [
            139.76982,
            35.67926
          ]
        },
        "Interpolated": false,
        "Label": "〒104-0028 東京都中央区八重洲2丁目2-7",
        "Municipality": "中央区",
        "PostalCode": "104-0028",
        "Region": "東京都",
        "TimeZone": {
          "Name": "Asia/Tokyo",
          "Offset": 32400
        }
      }
    },
    //....more result
  ],
  "Summary": {
    "DataSource": "Here",
    "Language": "ja",
    "MaxResults": 2,
    "Position": [
      139.76982180160718,
      35.679229460262974
    ]
  }
}
  

I hope that you can use this demo application to explore geocoding and search functionalities provided by HERE in the Amazon Location Service. To learn more about other functionalities, please check out this developer guide on Amazon Location Service. 

Erwin Soekianto

Erwin Soekianto

Developer Evangelist

Have your say

Sign up for our newsletter

Why sign up:

  • Latest offers and discounts
  • Tailored content delivered weekly
  • Exclusive events
  • One click to unsubscribe