DEV Community

Cover image for Create Map Images Using the Static Map Function of Amazon Location Service v2
Yasunori Kirimoto for AWS Heroes

Posted on

1

Create Map Images Using the Static Map Function of Amazon Location Service v2

In November 2024, Amazon Location Service v2 was finally released!

You can find out more in this article, so please check it out.

This article will introduce how to use the static map (GetStaticMap) in the Maps API. This function was newly added with Amazon Location Service v2, and you can create map images with the specified parameters.

The thread I posted on X also summarizes the recommended points of v2. 🗺️

https://x.com/dayjournal_nori/status/1855029985108795676

Advance Preparation

Create an API key for Amazon Location Service v2

Amazon Location Service #007 - API Key Creation (v2)

How to use the static map

Using the static map function of Amazon Location Service v2, you can easily create map images that can be used for various purposes, such as storing maps and reports, simply by specifying parameters in the URL. As of November 2024, the available map styles are limited to "Satellite," but there is also the possibility that new styles will be added. Here, we will introduce some examples of basic parameters, but many more are available. Please try customizing them.

Creating a basic map image

As a basic example, we will create a map of the area around Tokyo Station with a zoom level of 14, an image size of 1024px, and a scale bar included.

https://maps.geo.ap-northeast-1.amazonaws.com/v2/static/map?&style=Satellite&scale-unit=Kilometers&center=139.767,35.681&width=1024&height=1024&zoom=14&key=v1.public.xxxxx
Enter fullscreen mode Exit fullscreen mode

Endpoint: https://maps.geo.${region}.amazonaws.com/v2/static/
FileName: map
Style: style=Satellite
ScaleBarUnit: scale-unit=Kilometers
Center: center=139.767,35.681
Width: width=1024
Height: height=1024
Zoom: zoom=14
API key: key=v1.public.xxxxx

img

Create a zoomed in map image

Next, let's create a map image with the zoom level increased from 14 to 16, using the basic example.

https://maps.geo.ap-northeast-1.amazonaws.com/v2/static/map?&style=Satellite&scale-unit=Kilometers&center=139.767,35.681&width=1024&height=1024&zoom=16&key=v1.public.xxxxx
Enter fullscreen mode Exit fullscreen mode

Zoom: zoom=16

img

Create a map image with added point information

Finally, create a map image with added point information as an overlay. If it is a simple object, you can add it by specifying the parameters.

https://maps.geo.ap-northeast-1.amazonaws.com/v2/static/map?&style=Satellite&scale-unit=Kilometers&center=139.767,35.681&width=1024&height=1024&zoom=16&compact-overlay=point:139.767,35.681;label=Tokyo Station;size=large&key=v1.public.xxxxx
Enter fullscreen mode Exit fullscreen mode

CompactOverlay: compact-overlay=
Point: point:139.767,35.681;
Label: label=Tokyo Station;
Size: size=large

img

Related Articles

References
Amazon Location Service

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay