Building a Map Application with Amazon Location Service v2 and MapLibre GL JS
This is an example of using the new map styles in Amazon Location Service v2, released in November 2024.
Published Nov 18, 2024
In November 2024, Amazon Location Service v2 was finally released!
I was offered by the service team and participated in the verification work before the release. In the new version, several new features have been added, greatly improving the convenience of use. In particular, it is worth noting that the API is now available at a unified endpoint without creating resources.
This change means that users no longer need to prepare individual resources and can start using the API immediately. In addition, the Maps API, Places API, and Routes API have been significantly enhanced, and new features have been added, making them even more useful for a wider range of applications. Furthermore, they continue to be compatible with open source map libraries, and in particular, they work smoothly in combination with MapLibre GL JS.
This change means that users no longer need to prepare individual resources and can start using the API immediately. In addition, the Maps API, Places API, and Routes API have been significantly enhanced, and new features have been added, making them even more useful for a wider range of applications. Furthermore, they continue to be compatible with open source map libraries, and in particular, they work smoothly in combination with MapLibre GL JS.
This article will introduce how to use the new map styles(GetStyleDescriptor) in the Maps API. With Amazon Location Service v2, the old map styles have been discontinued, and new map styles unique to AWS have been adopted.
The thread I posted on X also summarizes the recommended points of v2. 🗺️
https://x.com/dayjournal_nori/status/1855029985108795676
https://x.com/dayjournal_nori/status/1855029985108795676
I have built a starter that supports Amazon Location Service v2. The created environment is available on GitHub. Please use it.
- node v22.3.0
- npm v10.8.1
Fork or download the Amazon Location Service v2 starter to your local environment and run it. In the env file, set the region name, the API key you created in advance, and the fixed map style name. As of November 2024, four map styles are available: Standard, Monochrome, Hybrid, and Satellite.
Here, we will introduce the contents of the starter.
Amazon Location Service has been updated to v2, and the method for specifying style URLs and parameters has changed.
Version that requires the previous resources
Specify region, resource name, and API key
Specify region, resource name, and API key
Version that does not require the latest resources (v2)
Specify region, fixed style name, and API key
Specify region, fixed style name, and API key
References