

# Amazon Location Service Maps
<a name="maps"></a>

![\[Map icon leading to SDK package, then to multiple devices showing maps.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/maps-overview.png)


Amazon Location Service Maps give you access to base map data for 190 countries with 5 million daily updates. Static and dynamic map capabilities provide flexibility to meet diverse user needs and deliver immersive, contextually relevant mapping solutions.

## Maps offering
<a name="maps-offering"></a>

Amazon Location Service offers dynamic and static maps.

**Dynamic maps**  
Use AWS Map Styles including standard, monochrome, hybrid, and satellite. Add interactive maps to your application using AWS map style and [MapLibre](https://maplibre.org/) rendering engine. Dynamic maps support gestures including zoom, pan, ease, fly, pitch, rotate, and bearing. For more details, see [dynamic maps](https://docs.aws.amazon.com/location/latest/developerguide/dynamic-maps.html).

**Static maps**  
Use static map URLs to embed simple map images in websites, reports, or emails without a map rendering engine. Static maps support overlays including markers (pins), routes, and polygon areas for your application. For more details, see [static maps](https://docs.aws.amazon.com/location/latest/developerguide/static-maps.html).

## Prebuilt map styles
<a name="prebuilt-map-styles"></a>

AWS map styles follow recognized industry conventions and deliver a polished, professional visual appearance. These ready-made styles accelerate development without requiring custom cartographic design. Build attractive, user-ready maps with minimal effort. For more details, see [AWS map styles](https://docs.aws.amazon.com/location/latest/developerguide/map-styles.html).

## Features
<a name="maps-features"></a>

AWS Map features provide enhanced visualization options for geographic, [topographic](https://docs.aws.amazon.com/location/latest/developerguide/maps-topographic-map.html), and [navigation](https://docs.aws.amazon.com/location/latest/developerguide/maps-navigation-map.html) such as transit, logistics, and real-time traffic data. Create informative, context-aware map experiences tailored to your specific needs. AWS maps support [internationalization and localization](https://docs.aws.amazon.com/location/latest/developerguide/maps-localization-internationalization.html) including political views and languages. Choose Point of interest (POI) and [color schemes](https://docs.aws.amazon.com/location/latest/developerguide/maps-color-scheme.html) that suit your use case. For more details, see [map features](https://docs.aws.amazon.com/location/latest/developerguide/maps-concepts.html).

## Common use cases
<a name="maps-usecases"></a>

**Embed maps in your application**  
Build maps into your applications to create location-based experiences. Visualize business locations, search for points of interest, and help users find specific addresses. Enable seamless location sharing and geotagging features to engage your customers. Use comprehensive map data, robust geocoding, and flexible rendering to create customized, interactive maps tailored to your needs. Integrate dynamic, high-quality mapping experiences that drive user engagement and business insights into your application, whether you're building a directory, ride-sharing app, or social platform.

**Static maps for reporting or printing**  
Seamlessly add images of street maps, satellite imagery, and location-based visuals into your websites, documents, and applications. Static maps enable you to create customizable map images that provide geographical context, without complex client-side rendering. Display delivery route on receipts, include location details in documents, or integrate maps into your digital experiences.

**Analyze and visualize data**  
Overlay your data onto high-quality maps to uncover transformative spatial patterns and trends. Empower your teams to create customizable, interactive map visualizations with your geographic data. Use maps and your data to optimize site selection, plan infrastructure, or analyze market opportunities.

**Enhance real estate experiences**  
Provide prospective buyers with comprehensive location context for real estate listings. Display the property's exact location, as well as surrounding neighborhood details like jurisdictional boundaries, local businesses, parks, and schools. Help customers find directions to your open houses. Create informative, location-centric real estate experiences that engage and inform your clients.

**Build engaging travel experiences**  
Display dynamic maps showcasing destinations, with detailed street views and key geographical features. Highlight hotels, restaurants, and other points of interest for tourists and travelers. Plot outdoor amenities, like hiking trails, to help users plan their ideal itinerary.

**Use maps to support disaster response efforts**  
Timely and accurate location information is critical during crises. Use mapping capabilities to build websites and applications that provide essential context to communities during pending disasters like fires, hurricanes, and floods. Display dynamic maps showcasing evacuation routes, safe shelters, road closures, and traffic congestion to help empower communities to quickly assess the situation and make informed decisions.

## Standalone Map APIs
<a name="maps-apis"></a>


|  API Name  |  Short Description  |  Resources  | 
| --- | --- | --- | 
|  GetStyleDescriptor  |  Retrieves the available map styles, such as standard, monochrome, hybrid, and satellite, that can be applied to maps.  |  [AWS map styles and features](map-styles.md)  | 
|  GetTile  |  Fetches individual map tiles based on a specified style and zoom level, allowing for the rendering of maps at various levels of detail.  |  [Tiles](tiles.md)  | 
|  GetStaticMap  |  Generates a static map image based on specific coordinates and parameters, useful for embedding maps in reports or emails.  |  [Static maps](static-maps.md)  | 

## Displaying Map
<a name="maps-display"></a>


|  Topic  |  Short Description  |  Resources  | 
| --- | --- | --- | 
|  Styling Dynamic Map  |  Amazon Location Service provides two options for styling your dynamic maps namely using predesigned AWS Map Styles and customizing map style using style descriptors.  | [Style dynamic maps](styling-dynamic-maps.md) [Standard map style](standard-map-style.md) [Monochrome map style](monochrome-map-style.md) [Hybrid map style](hybrid-map-style.md) | 
|  Rendering Dynamic Map  |  Amazon Location Service recommends rendering maps using the [MapLibre](https://github.com/maplibre/maplibre-gl-js) rendering engine. MapLibre is an engine for displaying maps in web or mobile applications.  |  [Map Rendering SDK by language](map-rendering-by-language.md)  | 
|  Customizing Static Map  |  How to customize static maps generated using Amazon Location Service.  |  [Customize static maps](customizing-static-maps.md)  | 
|  Overlaying Static Map  |  Overlay on your static maps to enhance the map's visual representation.  |  [Overlay on the static map](overlaying-static-map.md)  | 

# Map concepts
<a name="maps-concepts"></a>

Amazon Location Service provides comprehensive mapping capabilities that enable you to create customized, visually consistent maps for your applications. You can leverage AWS map styles and design principles to customize the look and feel of your maps, ensuring visual consistency and branding.

For customers in `ap-southeast-1` and `ap-southeast-5`, supported request and response fields may differ. Refer to the [Maps API Reference](https://docs.aws.amazon.com/location/latest/APIReference/API_Operations_Amazon_Location_Service_Maps_V2.html) for details.

This topic covers essential mapping concepts including terminology, localization, internationalization, and map features.

## Features
<a name="maps-concepts-features"></a>

Amazon Location Service enables you to customize maps with advanced styling features. Add topographic elements such as terrain and contour density, plus route-related features like traffic and travel modes (truck or transit). These customization options help you tailor map appearances for specific use cases, including logistics, transit, or outdoor terrain visualization.


| Feature name | Description | Supported values | Supported map styles | 
| --- | --- | --- | --- | 
| Color scheme | Set color scheme for maps | Light and Dark | Standard, Monochrome, Hybrid, Satellite | 
| Terrain | Show topographic hillshade | Hillshade and Terrain3D | Standard, Monochrome, Hybrid (Terrain3D), Satellite (Terrain3D) | 
| ContourDensity | Show topographic elevation lines | Low, Medium, High | Standard, Monochrome, Hybrid | 
| Traffic | Show real-time traffic conditions | All, Congestion | Standard, Monochrome, Hybrid | 
| Buildings | Show three-dimensional building structures | Buildings3D | Standard, Monochrome | 
| TravelModes | Optimize map style for travel modes | Transit and Truck | Standard, Monochrome, Hybrid | 
| Language | Set local language | BCP47 language codes (e.g., en-US, es-ES, fr-CH) | Standard, Monochrome, Hybrid | 
| PoliticalView | Tailored geopolitical views of specific country | Argentina, Cyprus, Egypt, Georgia, Greece, Kenya, Morocco, Palestine, Serbia, Russia, Sudan, Suriname, Syria, Türkiye, Tanzania, Uruguay | Standard, Monochrome, Hybrid | 

For more information about the Standard, Monochrome and Hybrid styles, see [Amazon Location Service map styles](https://docs.aws.amazon.com/location/latest/developerguide/map-styles.html).

**Topics**
+ [

## Features
](#maps-concepts-features)
+ [

# Maps terminology
](maps-terminology.md)
+ [

# Color scheme
](maps-color-scheme.md)
+ [

# Topography
](maps-topographic-map.md)
+ [

# Navigation
](maps-navigation-map.md)
+ [

# Localization and internationalization
](maps-localization-internationalization.md)
+ [

# 3D Features
](maps-3d-map.md)

# Maps terminology
<a name="maps-terminology"></a>

Understanding these key terms helps you effectively use Amazon Location Service mapping APIs and resources.

**Basemap**  
A basemap provides geographic context to your map, stored as vector tile layers. These tile layers include geographical features such as street names, buildings, and land use for visual reference.

**Vector**  
Vector data consists of points, lines, and polygons, and is used to represent roads, locations, and areas on a map. Vector shapes can also be used as icons for markers on a map.

**Raster**  
Raster data is image data made up of a grid, typically representing continuous data like terrain, satellite imagery, or heat maps. Raster images can also be used as icons or textures on a map.

**Map Rendering**  
The map rendering library pulls data from Amazon Location Service at runtime, rendering the map based on the selected map resource. A map resource defines the data provider and map style. Amazon Location Service requires the [MapLibre](https://maplibre.org/) rendering engine.

**Vector Tile**  
A vector tile stores map data using vector shapes. It adjusts to display resolution and selectively renders features while maintaining small file size for optimal performance. Supported format:[ Mapbox Vector Tiles (MVT)](https://docs.mapbox.com/data/tilesets/guides/vector-tiles-standards/).

**Map Style**  
A map style defines color and other styling information for map data, determining how the map appears when rendered. Amazon Location Service provides map styles based on the Mapbox GL style specification.

**Glyph File**  
A binary file containing encoded Unicode characters, used by a map renderer to display labels.

**Sprite File**  
A Portable Network Graphic (PNG) image file that contains small raster images and corresponding location descriptions in a JSON file. Used by a map renderer to display icons or textures on a map.

**Bounding Box**  
A bounding box is defined by two diagonal corner points: the northwest (NW) (top-left) and southeast (SE) (bottom-right) points. These points specify the spatial extent of a map.

# Color scheme
<a name="maps-color-scheme"></a>

Amazon Location Service allows you to set the color scheme for maps. The color-scheme parameter sets the map's color palette, such as `Light` or `Dark`, to better align with your application's design and accessibility needs.

## Light and Dark color schemes
<a name="maps-color-scheme-light-dark"></a>

The `Light` mode is versatile and fits into any context, while the `Dark` mode features a constrained palette designed to show details clearly and maintain readability in darker environments.

------
#### [ Standard ]

![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/color-scheme-standard.png)


------
#### [ Monochrome ]

![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/color-scheme-monochrome.png)


------
#### [ Hybrid ]

![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/color-scheme-hybrid.png)


------
#### [ Satellite ]

![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/color-scheme-satellite.png)


------

# Topography
<a name="maps-topographic-map"></a>

Topographic features such as terrain and contour lines display elevation changes and geographic features. This helps users better understand the physical landscape and terrain characteristics of their mapped areas.

## Terrain
<a name="maps-topographic-terrain"></a>

The terrain feature displays the earth's surface with elevation shading, representing elevation changes and natural landforms. It helps users interpret the shape and structure of the landscape within their mapped regions.

Use the `terrain` parameter in your API request to display regional topography with elevation shading. This feature highlights variations in elevation and geographic features, helping users better visualize the physical landscape. See [How to create topographic maps](https://docs.aws.amazon.com/location/latest/developerguide/how-to-create-topographic-maps.html).

![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/map-topographic-terrain.gif)


## 3D Terrain
<a name="maps-topographic-3d-terrain"></a>

The 3D Terrain feature renders elevation data of the Earth's surface as a three-dimensional surface, allowing users to view landscapes from multiple angles and perspectives. By controlling the viewing angle, users can more easily gain depth perception and assess terrain complexity, slopes, and relative heights across mapped areas.

Use the `terrain` parameter in your API request to enable three-dimensional terrain visualization. This feature provides an immersive perspective of topographic features, making it particularly useful for understanding spatial relationships in mountainous or varied terrain.

Combine 3D terrain with `contour-density` parameter in your API request for enhanced elevation precision and visual context. See [Create a 3D map](https://docs.aws.amazon.com/location/latest/developerguide/how-to-create-a-3d-map.html).

------
#### [ Satellite ]

![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/zoom-hybrid-3d-terrain.gif)


------
#### [ Standard ]

![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/zoom-3d-terrain.gif)


------

## Contour density
<a name="maps-topographic-contour-density"></a>

The contour density feature visualizes contour lines to represent terrain steepness and elevation variation. Users can easily identify slopes, elevation gradients, and other topographic patterns with this.

Use the `contour-density` parameter in your API request to render topographical elevation contour lines that represent terrain steepness and shape. This provides detailed visualization of landforms at varying density levels for enhanced topographic understanding. See [How to create topography maps](https://docs.aws.amazon.com/location/latest/developerguide/how-to-create-topographic-maps.html).

------
#### [ Low ]

![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/zoom-contours-low.gif)


------
#### [ Medium ]

![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/zoom-contours-medium.gif)


------
#### [ High ]

![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/zoom-contours-high.gif)


------

# Navigation
<a name="maps-navigation-map"></a>

The navigation features such as `Traffic` and `Truck TravelModes` provide dynamic visualization tools that enhance navigation and route planning. They help users understand real-time road conditions and choose the most efficient travel options based on their transportation needs.

## Traffic
<a name="maps-navigation-traffic"></a>

The traffic layer provides real-time visualization of traffic conditions, including road congestion, construction zones, and reported incidents. This feature helps users make informed routing decisions and optimize travel efficiency based on current roadway conditions.

Use the `traffic` parameter in your API request to display real-time traffic information. This includes data on road congestion, construction areas, and incidents, helping users make informed and efficient routing decisions. See [how to show real-time traffic on a map](https://docs.aws.amazon.com/location/latest/developerguide/how-to-set-real-time-traffic-map.html).

------
#### [ All ]

![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/zoom-traffic-all.gif)


------
#### [ Congestion ]

![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/zoom-traffic-congestion.gif)


------

## Travel modes
<a name="maps-navigation-travel-modes"></a>

The travel modes feature enables visualization and selection of different transportation methods. It supports routing information for various modes such as public transit, trucking, or other specialized navigation types that consider road restrictions and regulations. This helps users plan routes optimized for their specific mode of travel.

Use the `travel-modes` parameter in your API request to show transportation-specific routing data. See [how to show transit details on a map](https://docs.aws.amazon.com/location/latest/developerguide/how-to-show-transit-details-map.html) and [how to create a logistics map](https://docs.aws.amazon.com/location/latest/developerguide/how-to-create-logistic-map.html).

![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/map-travel-modes-transit.gif)


![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/map-travel-modes-truck.gif)


# Localization and internationalization
<a name="maps-localization-internationalization"></a>

Amazon Location Service supports localization features that enable you to customize maps for specific languages and regions. This includes support for local place names and the ability to render maps in different languages.


| Style | Political View | Languages | 
| --- | --- | --- | 
| Standard | Argentina, Cyprus, Egypt, Georgia, Greece, Kenya, Morocco, Palestine, Serbia, Russia, Sudan, Suriname, Syria, Türkiye, Tanzania, Uruguay | Supported through client-side library | 
| Monochrome | Argentina, Cyprus, Egypt, Georgia, Greece, Kenya, Morocco, Palestine, Serbia, Russia, Sudan, Suriname, Syria, Türkiye, Tanzania, Uruguay | Supported through client-side library | 
| Hybrid | Argentina, Cyprus, Egypt, Georgia, Greece, Kenya, Morocco, Palestine, Serbia, Russia, Sudan, Suriname, Syria, Türkiye, Tanzania, Uruguay | Supported through client-side library | 
| Satellite | Not supported | Not supported | 

## Languages
<a name="maps-languages"></a>

Amazon Location Service provides Maps APIs that enable you to customize the language of map labels and text elements. This capability helps your applications cater to a global audience or regions with multiple languages. By displaying maps in the user's preferred language, you enhance the overall user experience, making the maps more accessible and relevant to your diverse user base.

For more information, see [How to set a preferred language for a map](how-to-set-preferred-language-map.md).

![\[Map of Taiwan showing major cities including Taipei, Taichung, and Kaohsiung along the western coast.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/standard-language-switcher.gif)


## Political view
<a name="maps-political"></a>

By default, Amazon Location Service presents an international perspective, which visually represents disputed territories with dashed borders. To switch from the international perspective to a country-specific geopolitical view, use the *political view* parameter in your API query. This helps businesses comply with local laws, as certain countries require adherence to their specific geopolitical views for maps and map data.

In addition to the default international perspective, Amazon Location Service supports the geopolitical views of the following countries: Argentina, Cyprus, Egypt, Georgia, Greece, Kenya, Morocco, Palestine, Serbia, Russia, Sudan, Suriname, Syria, Türkiye, Tanzania, Uruguay. To activate a geopolitical view, pass the appropriate value to the *political view* parameter.

For more information, see [How to set the political view of a map](how-to-set-political-view-map.md).

![\[Map of Cyprus showing the locations of Nicosia and Limassol, with surrounding waters.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/maps-political-view.png)


# 3D Features
<a name="maps-3d-map"></a>

Amazon Location Service's 3D visualization capabilities - terrain and buildings - help users make better decisions by adding depth and perspective to geographic data. 3D terrain reveals elevation changes critical for route optimization, emergency response planning, and outdoor recreation, while 3D buildings provide spatial context for urban navigation, real estate assessment, and landmark identification. These features integrate seamlessly through simple API parameters (terrain, buildings), enabling applications across logistics, public safety, tourism, and real estate to deliver more intuitive and engaging user experiences without complex implementation.

## 3D Terrain
<a name="maps-3d-terrain"></a>

The 3D Terrain feature renders elevation data of the Earth’s surface as a three-dimensional surface, allowing users to view landscapes from multiple angles and perspectives. By controlling the viewing angle, users can more easily gain depth perception and assess terrain complexity, slopes, and relative heights across mapped areas.

Use the `terrain` parameter in your API request to enable three-dimensional terrain visualization. This feature provides an immersive perspective of topographic features, making it particularly useful for understanding spatial relationships in mountainous or varied terrain.

Combine 3D terrain with `contour-density` parameter in your API request for enhanced elevation precision and visual context. See [Create a 3D map](https://docs.aws.amazon.com/location/latest/developerguide/how-to-create-a-3d-map.html).

------
#### [ Satellite ]

![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/zoom-hybrid-3d-terrain.gif)


------
#### [ Standard ]

![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/zoom-3d-terrain.gif)


------

## 3D Buildings
<a name="maps-3d-buildings"></a>

The 3D Buildings feature renders building footprints as three-dimensional structures with height and volume, allowing users to visualize urban environments from multiple angles and perspectives. By controlling the viewing angle, users can more easily understand building density, height relationships, and spatial context within cities and developed areas.

Use the `buildings` parameter in your API request to enable three-dimensional building visualization. This feature provides an immersive perspective of urban landscapes, making it particularly useful for understanding city layouts, identifying landmarks, and navigating complex urban environments.See [Create a 3D map](https://docs.aws.amazon.com/location/latest/developerguide/how-to-create-a-3d-map.html).

![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/zoom-3d-buildings.gif)


## Globe View
<a name="maps-3d-globe-view"></a>

The Globe View feature provides a spherical representation of the Earth, allowing users to visualize geographic data on a three-dimensional globe. This perspective offers a natural and intuitive way to understand global spatial relationships, continental layouts, and the curvature of the Earth's surface.

Use Globe View to display maps with realistic Earth curvature and global perspective. See [Create a 3D map](https://docs.aws.amazon.com/location/latest/developerguide/how-to-create-a-3d-map.html).

![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/zoom-globe-view.gif)


# AWS map styles and features
<a name="map-styles"></a>

## Map styles overview
<a name="map-style-overview"></a>

To request a map, you must choose first a map style. Map styles define the visual appearance of the rendered map, including the styling for map tiles, glyphs, and sprites. Map tiles can be either vector (MVT) or raster (image). While the style may change as you zoom in or out, it generally maintains a consistent theme. You can override parts or the entire style before passing it to the map rendering library.

## AWS map styles
<a name="aws-map-styles"></a>

AWS map styles adhere to industry standards, offering a sophisticated and professional look. These styles reduce time-to-market and eliminate the need for dedicated cartographers to create map styles from scratch. These predesigned styles enable you to quickly and effectively create visually appealing maps for your end users.

By leveraging the predesigned AWS map styles, you can bypass the time-consuming and resource-intensive process of designing and constructing map styles from scratch. This accelerates your development process, allowing you to focus on core functionalities.




| Map style name | Description | Color scheme | Supports Dynamic Map | Supports Static Map | 
| --- | --- | --- | --- | --- | 
| Standard | Colored map style | Dark and Light | Yes | Yes | 
| Monochrome | Grey scale map styles | Dark and Light | Yes | No | 
| Hybrid | Road and label overlay on satellite imagery | Not Applicable | Yes | No | 
| Satellite | Satellite imagery-based map style | Not Applicable | Yes | Yes | 

Amazon Location Service provides styles following the [MapLibre GL style specification](https://maplibre.org/maplibre-style-spec/).

## Standard map style
<a name="standard-map"></a>

The Standard map style is a clean and modern general-purpose map design that fits beautifully and functionally into almost any application or website.

To learn more, see [Standard map style](standard-map-style.md).

![\[Map of Boston showing neighborhoods, streets, and waterways in standard and dark modes.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/map-standard.png)


## Monochrome map style
<a name="monochrome-map"></a>

The Monochrome map style is a minimalist canvas with a constrained color palette, designed for use with data visualization overlays. The Monochrome style offers both light and dark modes, communicating all the essential information needed for geographic context.

To learn more, see [Monochrome map style](monochrome-map-style.md).

![\[Two maps of North America, one light and one dark, showing countries and major bodies of water.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/map-monochrome.png)


## Hybrid map style
<a name="hybrid-map"></a>

The hybrid map style combines global satellite imagery with clear labels and configurable POI categories from our vector maps.

To learn more, see [Hybrid map style](hybrid-map-style.md).

![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/map-hybrid.png)


## Satellite map style
<a name="satellite-map"></a>

The Satellite map style presents high-resolution, real-world imagery captured by satellites, offering a realistic view of landscapes, buildings, and terrain. This style typically includes minimal labels or overlays to keep the focus on geographical details.

![\[Satellite view of Australia, New Zealand, and Southeast Asian islands surrounded by deep blue oceans.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/map-satellite.png)


# Standard map style
<a name="standard-map-style"></a>

The Standard map style offers a clean, modern, and general-purpose map design that can seamlessly fit into almost any application or website.

## Color scheme
<a name="color-scheme"></a>

The Standard map style comes in both light and dark modes. The light mode is versatile and can fit into any context, while the dark mode features a constrained palette, designed to show details clearly and maintain readability in darker environments. This ensures minimal distractions, especially in scenarios such as night-time navigation.

------
#### [ Forest ]

![\[Map of Washington state and Vancouver area showing coastal regions and major cities.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/color-scheme-forest.png)


------
#### [ Road ]

![\[Map of Bronx area showing highways, neighborhoods, and landmarks in light and dark modes.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/color-scheme-road.png)


------
#### [ City ]

![\[Map of Boston showing neighborhoods, streets, and waterfront areas in light and dark modes.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/color-scheme-city.png)


------
#### [ Neighborhood ]

![\[Map of Montreal showing districts, landmarks, and streets in light and dark modes.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/color-scheme-neighborhood.png)


------

## A pleasing, modern palette
<a name="modern-palette"></a>

Soft colors provide important land-use context without overwhelming the map, offering useful information at both high and low zoom levels. Zoomed out, features such as forests, deserts, and glaciers add richness to the map. When zoomed in, a range of colors highlights important landmarks like schools, hospitals, recreation areas (like parks and sports facilities), and urban districts like commercial and industrial zones.

The overall style features a cohesive color palette, including POI markers that complement their respective land-use areas. The road network is displayed in shades of gray, providing detail without overwhelming the map with bright, distracting colors.

------
#### [ Highway ]

![\[Map of San Francisco Bay Area showing cities and highways in standard and dark modes.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/modern-highway.png)


------
#### [ Beach ]

![\[Map of Malibu area showing Pacific Coast Highway, Legacy Park, and Malibu Lagoon State Beach.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/modern-beach.png)


------
#### [ Island ]

![\[Map of Oahu island showing major highways, Honolulu, and surrounding areas in day and night views.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/modern-island.png)


------
#### [ Neighborhood ]

![\[Map of downtown Honolulu showing streets, landmarks, and neighborhoods in light and dark modes.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/modern-neighborhood.png)


------
#### [ Intersection ]

![\[Map of Lower Manhattan showing City Hall Park, streets, and landmarks in light and dark modes.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/style-intersection.png)


------
#### [ Roundabout ]

![\[Map of Washington Circle area showing streets, landmarks, and points of interest in light and dark modes.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/style-roundabout.png)


------

## Rich points of interest (POI)
<a name="rich-poi"></a>

The Standard map style supports a rich array of configurable points of interest (POIs). With just a few lines of code, you can select the POI categories relevant to your use case.

![\[Map showing various points of interest in Midtown Manhattan, including businesses and landmarks.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/poi-toggle-animation.gif)


## Designed for the world
<a name="designed-for-the-world"></a>

The Standard style supports different political views, ensuring that maps display the correct borders for your users. The style also allows easy language switching for map labels, with dozens of supported languages and writing systems.

To learn more, see [Localization and internationalization](maps-localization-internationalization.md).

------
#### [ Languages ]

![\[Map of Taiwan showing major cities and geographical features including Taiwan Strait.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/standard-language-switcher.gif)


------
#### [ Political view ]

![\[Map of Cyprus showing Nicosia in the north and Limassol in the south, with surrounding Mediterranean Sea.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/maps-political-view.png)


------

## Topography
<a name="topography"></a>

The Standard map style provides detailed topographic visualization that highlights elevation variations and natural geographic features. Contour lines, shading, and terrain textures create a realistic representation of the landscape, enabling users to easily interpret slopes, valleys, and peaks. This topographic rendering is ideal for outdoor planning, environmental analysis, and applications where understanding terrain characteristics enhances decision-making and spatial awareness.

------
#### [ Both Terrain and Contour Density ]

 ![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/map-terrain-contour-light.png) ![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/map-terrain-contour-dark.png) 

------
#### [ Only terrain ]

 ![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/map-terrain-light.png) ![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/map-terrain-dark.png) 

------
#### [ Only contour density ]

 ![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/map-contour-light.png) ![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/map-contour-dark.png) 

------

## Navigation
<a name="navigation"></a>

The Standard map style provides options to provide dynamic visualization designed to optimize navigation and route planning. Live traffic data highlights congestion, incidents, and road conditions, enabling users to anticipate delays and adjust their routes accordingly. With multiple travel modes—such as truck or public transit—this feature empowers users to select the most efficient and context-appropriate option for their route, ensuring smoother and more informed routing experiences.

------
#### [ Traffic ]

 ![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/traffic-light.png) ![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/traffic-dark.png) 

------
#### [ Transit ]

 ![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/transit-light.png) ![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/transit-dark.png) 

------
#### [ Truck ]

 ![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/truck-light.png) ![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/truck-dark.png) 

------

## 3D
<a name="3D"></a>

The Standard map style provides immersive three-dimensional visualization that renders terrain elevation and building structures with spatial depth and perspective. Adjustable viewing angles, pitch controls, and three- dimensional rendering create a realistic representation of both natural landscapes and urban environments, enabling users to easily interpret elevation changes, terrain complexity, and spatial relationships. This three-dimensional rendering is ideal for route planning, urban navigation, and applications where understanding vertical dimensions and depth perception enhances decision-making and spatial awareness..

------
#### [ 3D Terrain ]

 ![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/3d-terrain-light.png) ![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/3d-terrain-dark.png) 

------
#### [ 3D Buildings ]

 ![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/3d-buildings-light.png) ![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/3d-buildings-dark.png) 

------

## Land use
<a name="land-use"></a>

The Standard map style uses vibrant colors to indicate designated land uses. Greens represent forests, grass, golf courses, sports centers, and parks. Relevant colors are used for water bodies, glaciers, deserts, and beaches. Additionally, land uses such as commercial, industrial, airports, military zones, medical facilities, and educational areas are highlighted with specific vibrant categories.

------
#### [ Light ]

![\[Color-coded squares representing various land uses with corresponding hex codes.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/land-use-light.png)


------
#### [ Dark ]

![\[Color-coded squares representing various land uses with corresponding hex codes and labels.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/land-use-dark.png)


------

# Monochrome map style
<a name="monochrome-map-style"></a>

The Monochrome style is a minimalist canvas with a constrained color palette, designed for use with data visualization overlays. This style supports both light and dark modes, each of which communicates all the essential information needed for geographic context.

## Color schemes
<a name="color-schemes"></a>

The Monochrome style offers color choices for both dark and light modes.

------
#### [ Continent ]

![\[Map of North America showing the United States, Canada, Mexico, and parts of Central and South America.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/monochrome-continent.png)


------
#### [ Neighborhood ]

![\[Map of Downtown Miami showing streets, parks, and landmarks in light and dark modes.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/monochrome-neighborhood-colors.png)


------

## Use cases
<a name="use-case"></a>

The Monochrome style is well-suited for data visualization and minimalistic design needs.

### Data visualization
<a name="data-visualization"></a>

The Monochrome style deliberately uses only shades of gray, allowing you complete freedom of color choice for data overlay layers such as choropleths, heatmaps, or dot maps.

![\[Map of lower Manhattan showing streets, landmarks, and red dots indicating data points.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/monochrome-data-vis.png)


### Minimalist design
<a name="minimalist"></a>

To maintain a clean and unobtrusive map, the Monochrome styles include a reduced set of points of interest (POIs) for essential features, such as airports, parks, hospitals, and universities.

------
#### [ Airport ]

![\[Map showing Miami International Airport and surrounding roads including Airport Expy and Dolphin Expy.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/monochrome-airport.png)


------
#### [ Neighborhood ]

![\[Map showing Jackson Memorial Hospital, UHealth Tower, and nearby streets in light and dark modes.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/monochrome-neighborhood.png)


------

Although the Monochrome style includes a reduced set of POIs, the underlying tiles still contain the complete set of POI data. This allows you to display POIs that are not visually present in the style.

## Designed for the world
<a name="designed-for-the-world"></a>

The Monochrome style supports different political views, ensuring that maps display the correct borders for your users. The style also allows for easy switching between languages for map labels, with dozens of supported languages and writing systems.

![\[Map of Taiwan showing major cities and the Taiwan Strait, with a monochrome color scheme.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/monochrome-language-switcher.gif)


# Hybrid map style
<a name="hybrid-map-style"></a>

The Hybrid map style combines global satellite imagery with the same clear labels and configurable points of interest (POI) categories found in the Standard map style. This combination provides rich geographic detail while ensuring readability and usability for your application.

## Rich points of interest (POI)
<a name="rich-poi"></a>

The labels and POIs have been specifically designed for contrast and readability, providing the necessary context for the satellite layer without distracting from the detailed imagery. Light road lines highlight the urban structure when zoomed out and gradually fade as you zoom in, revealing more detailed street-level information.

------
#### [ Zoom ]

![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/hybrid_zoom.gif)


------
#### [ Neighborhood ]

![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/hybrid-neighborhood.png)


------
#### [ Zoomed-in ]

![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/hybrid-zoom.png)


------

## Designed for the world
<a name="designed-for-the-world"></a>

The Hybrid style supports different political views, ensuring that the map displays the correct borders for your users. This style also allows for easy switching between languages for map labels, with dozens of supported languages and writing systems available to ensure a localized experience.

# Map APIs
<a name="choose-maps-apis"></a>

Maps provide access to both dynamic and static map types for a variety of applications. For more information, See [Amazon Location Service Maps](maps.md).
+ **Dynamic Maps**: Interactive maps that can be customized in real time, allowing users to pan, zoom, and overlay data. For more information, See [Dynamic maps](dynamic-maps.md).
+ **Static Maps**: Static images of maps that display specific locations or routes without interactive elements, suitable for applications with limited interactivity. For more information, See [Static maps](static-maps.md).

The following table presents a number of business use cases that are best solved with Maps APIs.

## Maps use cases
<a name="maps-table"></a>

The following section presents a number of business use cases that are best solved with Maps APIs.


| **Business need** | **Useful API** | **Examples** | 
| --- | --- | --- | 
|  **Display interactive maps** Supports map gestures, such as zoom, pan, ease, fly, pitch, rotate, and bearing.  | `GetTile` and `GetStyleDescriptor` with rendering engine (MapLibre) | [How to display a map](how-to-display-a-map.md) | 
|  **Add markers to a map** Examples are markers, icon, and more.  |  `GetTile` and `GetStyleDescriptor` with rendering engine (MapLibre) | [How to add a marker on the map](how-to-add-marker-on-map.md) [How to add an icon on the map](how-to-add-icon-on-map.md) | 
|  **Add user interaction components to a map** Examples are showing map in preferred language or geo-political view. |  `GetTile` and `GetStyleDescriptor` with rendering engine (MapLibre) | [How to add control on the map](how-to-add-control-on-map.md) [How to add a popup to a map](how-to-add-popup-to-map.md) | 
| **Visualize real time or pre-recorded data on a map** Examples are heat map, KML, GeoJSON features, polygons, rectangles, polylines, circles, markers, and more. | `GetTile` and `GetStyleDescriptor` with rendering engine (MapLibre) | [How to add a line on the map](how-to-add-line-on-map.md) [How to add a polygon on the map](how-to-add-polygon-on-map.md) | 
| **Display map with localization**Examples are showing map in preferred language or geo-political view. |  `GetTile` and `GetStyleDescriptor` with rendering engine (MapLibre) | [How to set a preferred language for a map](how-to-set-preferred-language-map.md) [How to set the political view of a map](how-to-set-political-view-map.md) | 
| **Display a static map image** For example, use map image in application, email, report, or print. | `GetStaticMap` | [How to get a static map of a specific position](get-static-map-specific-position.md) [How to get a static map of a specific dimension](get-static-map-specific-dimension.md) [How to decide between radius and zoom for a static map](choose-radius-vs-zoom.md) [How to add scale for a static map](add-scale-static-map.md)  | 
| **Add marker to a map image** Examples are markers, proximity circle, icon, and more. | `GetStaticMap` | [How to add a marker to a static map](add-marker-static-map.md) | 
| **Visualize data on a map image** Examples are GeoJSON features, polygons, rectangles, polylines, circles, and more. |  `GetStaticMap` | [How to add a line to a static map](how-to-add-line-static.md)  | 
| **Visualize real world use case on a map** Examples include routes, proximity circle, and more. |  `GetStaticMap` | [How to add a route to a static map](how-to-add-route.md)  | 
| **Visualize Places search and/or geocode result on a map **All APIs return geocoordinates, except autocomplete.  | GetTile and GetStyleDescriptor with rendering engine (MapLibre) with Places API |    | 
| **Draw a route on a map**Supports waypoint marking. | GetTile and GetStyleDescriptor with rendering engine (MapLibre) with Calculate route  |  | 
| **Visualize matched GPS traces on a map **Supports travel modes, such as truck, pedestrian, car, and scooter.  | GetStyleDescriptor with rendering engine (MapLibre) with Snap to road  |  | 

# Dynamic maps
<a name="dynamic-maps"></a>

**Note**  
You must use the political view feature to comply with applicable laws, including those related to mapping the country or region where maps, images, and other data you access through Amazon Location Service are made available.

Dynamic maps, also known as interactive maps, are digital maps that support gestures such as zoom, pan, ease, fly, pitch, rotate, and bearing. With Amazon Location Service, you can build map applications that provide responsive, interactive, and immersive experiences for your users. These maps help users visualize and analyze real-time and historical data based on user input, allowing them to pan, zoom, and explore the map in real-time. Maps offered by Amazon Location Service also support multiple languages and political views.

Learn more about [Localization and internationalization](maps-localization-internationalization.md).

For example requests, responses, cURL, and CLI commands for this API, see [How to use dynamic maps](https://docs.aws.amazon.com/location/latest/developerguide/dynamic-maps-how-to.html).

------
#### [ City ]

![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/dynamic-city.png)


------
#### [ Roads ]

![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/dynamic-roads.png)


------
#### [ Park ]

![\[alt text not found\]](http://docs.aws.amazon.com/location/latest/developerguide/images/dynamic-parks.png)


------

For more information about AWS Map Styles, see [AWS map styles and features](map-styles.md).

## Common use cases
<a name="common-use-cases"></a>

**Analyze and visualize data**  
Overlay your data onto high-quality maps to uncover transformative spatial patterns and trends. Empower your teams to create customizable, interactive map visualizations with your geographic data. Use maps and data to optimize site selection, plan infrastructure, or analyze market opportunities.

**Enhance real estate experiences**  
Provide prospective buyers with comprehensive location context for real estate listings. Display the property's exact location along with surrounding neighborhood details such as jurisdictional boundaries, local businesses, parks, and schools. Help customers find directions to your open houses and create informative, location-centric real estate experiences.

**Build engaging travel experiences**  
Display dynamic maps showcasing destinations, with detailed street views and key geographic features. Highlight points of interest such as hotels, restaurants, and attractions for tourists and travelers. Plot outdoor amenities like hiking trails to help users plan their ideal itinerary.

## Rendering dynamic maps
<a name="rendering-dynamic-map"></a>

A map rendering engine is a library responsible for the visual rendering of maps on digital screens. The rendering engine stitches map tiles (vector, hybrid, satellite), map data (points, lines, polygons), or raster data (imagery) together to display an interactive map in web browsers or native apps. Amazon Location Service recommends using the [MapLibre](https://github.com/maplibre/maplibre-gl-js) rendering engine, which supports both web and mobile (iOS and Android) platforms. MapLibre also provides a plugin model and supports user interfaces for searching and routing in various languages.

For more information, see [Create your first Amazon Location Maps and Places application](first-app.md).

## Requesting map assets
<a name="requesting-map-assets"></a>

The rendering engine uses a map style, which contains references to map tiles, sprites (icons), and glyphs (fonts). As users interact with the map—loading, panning, or zooming—the rendering engine calls APIs (for tiles, sprites, and glyphs) with the desired input parameters. You can also directly call these APIs based on your application's needs.

**Map tiles**  
Small square tiles containing data that are retrieved from servers and assembled by a rendering engine to create an interactive digital map.

**Map style**  
A collection of rules that define the visual appearance of the map, such as colors and styles. Amazon Location Service follows the [Mapbox GL style specification](https://docs.mapbox.com/style-spec/guides/).

**Glyph file**  
A binary file containing encoded Unicode characters, used by the map renderer to display text labels.

**Sprite file**  
A Portable Network Graphics (PNG) image file that contains small raster images, with location descriptions in a JSON file. Used by the map renderer to render icons or textures on the map.

# Tiles
<a name="tiles"></a>

Map tiles are pre-rendered, small sections of a larger map, typically displayed as square images. They are used to efficiently display geographic data by loading only the visible portions at different zoom levels. There are three main types of map tiles:

For more information, see [GetTile](https://docs.aws.amazon.com/location/latest/APIReference/API_geomaps_GetTile.html) in the *Amazon Location Service API Reference*.

## Tile types
<a name="tile-types"></a>

**Vector map tiles**  
Vector map tiles store map data as geometric shapes (points, lines, polygons) rather than as images. This enables the creation of high-quality, scalable maps that remain clear at any resolution.

**Raster map tiles**  
Raster map tiles are pre-rendered images representing a specific geographic area. Unlike vector tiles, raster tiles are simpler but lack flexibility for restyling.

**Hybrid map tiles**  
Hybrid map tiles combine both vector and raster data. They use vector data for core map elements, such as roads, while using raster imagery for more complex elements like detailed satellite or aerial photography.

## Vector tile layers
<a name="vector-tiles-layers"></a>

The following are the 10 layers of vector map tiles:
+ **Boundaries**: Defines administrative and geographic boundaries, including country, state, and city borders.
+ **Buildings and addresses**: Represents building shapes and detailed address points.
+ **Earth**: Shows global terrain and surface coverage for natural features like deserts, mountains, and forests.
+ **Land use**: Displays categorized areas such as parks, farmland, and urban zones.
+ **Places**: Identifies important locations like cities, towns, and notable landmarks.
+ **Points of interest (POIs)**: Highlights attractions, businesses, and other key locations.
+ **Roads**: Represents the network of streets, highways, and pathways.
+ **Road labels**: Provides text labels for road names and route numbers.
+ **Transit**: Depicts public transport lines such as buses, trains, and subways.
+ **Water**: Displays bodies of water, including lakes, rivers, and oceans.

## Use cases
<a name="tiles-use-cases"></a>
+ Fetching map tiles for rendering different sections of a map at various zoom levels.
+ Optimizing map tile requests based on user interaction, such as panning and zooming.
+ Accessing vector or raster tiles for detailed rendering purposes.

## Understand the request
<a name="tiles-understand-the-request"></a>

**Note**  
 For customers in `ap-southeast-1` and `ap-southeast-5`, supported request and response fields may differ. Refer to the [GetTile API Reference](https://docs.aws.amazon.com/location/latest/APIReference/API_geomaps_GetTile.html) for details. 

The request requires the following parameters: `Tileset`, `X`, `Y`, and `Z` to identify the specific tile to be fetched. The `Key` parameter can be optionally included for authorization.
+ **`Tileset`**: Specifies the desired tileset for fetching the tile.
+ **`X`**: The X-axis value for the map tile.
+ **`Y`**: The Y-axis value for the map tile.
+ **`Z`**: The zoom value, defining the zoom level for the tile.
+ **`Key`**: Optionally included for authorization purposes.

## Understand the response
<a name="tiles-understand-the-response"></a>

The response includes headers such as `CacheControl`, `ContentType`, and `ETag`, and contains the map tile data as a binary blob in MVT format. These headers manage cache control, provide content format details, and version control for tiles.
+ **`CacheControl`**: Controls client-side caching for the map tile.
+ **`ContentType`**: Specifies the format of the tile data.
+ **`ETag`**: Provides a version identifier for the tile.
+ **`Blob`**: Contains the vector tile data in MVT format.

# Style dynamic maps
<a name="styling-dynamic-maps"></a>

Amazon Location Service provides two options for styling your dynamic maps: using predesigned AWS Map Styles or customizing the map style using style descriptors.

For more information, see [GetStyleDescriptor](https://docs.aws.amazon.com/location/latest/APIReference/API_geomaps_GetStyleDescriptor.html) in the *Amazon Location Service API Reference*.

## Use predesigned AWS map styles
<a name="using-aws-map-styles"></a>

AWS map styles are predefined styles that adhere to industry standards to deliver a sophisticated, professional aesthetic. By leveraging these styles in Amazon Location Service, you can reduce time-to-market and eliminate the need for dedicated cartographers to create map styles from scratch.

For more information, see [AWS map styles and features](map-styles.md).

To learn more about predefined map styles, see:
+ [Standard map style](map-styles.md#standard-map)
+ [Monochrome map style](map-styles.md#monochrome-map)
+ [Hybrid map style](map-styles.md#hybrid-map)
+ [Satellite map style](map-styles.md#satellite-map)

## Add map style features to your AWS map
<a name="using-aws-map-features"></a>

AWS map style features enable you to customize your maps with advanced style features including terrain, contour density, traffic, and truck or transit overlays. These new customization options allow you to tailor map appearances to specific use cases.

For more information, see [map features](https://docs.aws.amazon.com/location/latest/developerguide/maps-concepts.html).

## Benefits of using AWS map styles
<a name="benefits-aws-map-styles"></a>
+ **Time and resource efficiency**: AWS Map Styles allow you to bypass the time-consuming and resource-intensive process of designing map styles from scratch. This allows you to focus on core functionalities while providing visually appealing maps.
+ **Professional and consistent aesthetics**: Skilled cartographers have meticulously crafted AWS Map Styles, following industry best practices. Every detail, from color palettes to label placements, has been optimized for clarity and legibility.
+ **Seamless integration**: AWS Map Styles integrate seamlessly with your application's design language, providing a polished and consistent mapping experience for your end-users.

## Get started with AWS map styles
<a name="getting-started-aws-map-styles"></a>
+ **Check the AWS map styles offering**: In the Amazon Location Service console, navigate to the **Map** section to explore the available styles.
+ **Choose the style that matches your needs**: Select the style that best aligns with your application's design and user experience requirements.
+ **Integrate the style**: Follow the provided documentation to integrate the chosen style into your application using Amazon Location Service APIs or SDKs.

Learn more about [How to display a map](how-to-display-a-map.md).

## Use cases
<a name="use-cases"></a>
+ Customizing map styles based on color schemes like `Light` or `Dark`.
+ Displaying maps according to specific political views or geographic boundaries.
+ Optimizing map styles for different use cases, such as logistics, outdoor activities, navigation with traffic data, and transportation-specific routing.

## Understand the request
<a name="dynamic-understand-the-request"></a>

**Note**  
 For customers in `ap-southeast-1` and `ap-southeast-5`, supported request and response fields may differ. Refer to the [GetStyleDescriptor API Reference](https://docs.aws.amazon.com/location/latest/APIReference/API_geomaps_GetStyleDescriptor.html) for details. 

The request supports parameters like `ColorScheme`, `Key`, and `PoliticalView` to define the map's style and presentation. The `Style` parameter is required to specify the desired map style.
+ **`ColorScheme`**: Sets the map's color palette, such as `Light` or `Dark`.
+ **`PoliticalView`**: Specifies the political view for map visualization.
+ **`Style`**: Defines the style of the map, like `Standard` or `Monochrome`.
+ **`Terrain`**: Displays topographic features through elevation shading and geographic highlighting.
+ **`ContourDensity`**: Shows terrain shape and steepness using elevation contour lines at varying density levels.
+ **`Traffic`**: Overlays real-time traffic conditions on the map.
+ **`TravelMode`**: Displays transportation information including public transit systems or truck routing with road restrictions.

## Understand the response
<a name="dynamic-understand-the-response"></a>

The response provides headers like `CacheControl`, `ContentType`, and `ETag`, and contains the style descriptor as a JSON blob. The headers give caching information, content format details, and versioning for style changes.
+ **`CacheControl`**: Controls caching configurations for the style descriptor.
+ **`ContentType`**: Indicates the response format as JSON.
+ **`ETag`**: Provides a version identifier for the style descriptor.
+ **`Blob`**: Contains the body of the style descriptor in JSON format.

## Customize style descriptors
<a name="customizing-style-descriptor"></a>

To customize map styles, you must understand the structure of the style descriptor, which is usually a JSON object defining the visual representation of map elements. The style descriptor comprises several layers, each controlling the style for a specific type of map element, such as roads, parks, buildings, or labels.
+ **Use a predefined style descriptor as a base**: You can either start with a predefined style descriptor or create one from scratch using map style editors such as [Maputnik](https://maputnik.github.io/).
+ **Understand the structure**: The style descriptor is a hierarchical JSON object that contains layers, each representing a different map element. Each layer has properties that control the visual appearance of that element, such as color, opacity, and line width.
+ **Modify styles for layers**: Depending on the map style editor you’re using, you can change existing layers or add new ones to customize the style. For example, you can adjust the color of roads, modify the font size of labels, or add custom icons for specific locations.
+ **Define styles for different zoom levels**: Map style editors allow you to define different styles for different zoom levels, which is useful for controlling the level of detail and visibility based on user zoom interactions.
+ **Test and iterate**: After modifying or creating the style descriptor, test the customized style on a map to ensure it displays as intended. Iterate and adjust until you achieve the desired visual style.

# Style iconography with sprites
<a name="styling-iconography-with-sprites"></a>

A sprite is a Portable Network Graphic (PNG) image file that contains small raster images such as icons, markers, and other elements rendered on a map. Sprites can be customized based on parameters like style, color scheme, and variant. Amazon Location Service provides a sprite sheet through the `GetSprites` API. You can also use custom icons by either loading your own icon set (see [How to add an icon on the map](how-to-add-icon-on-map.md)) or customizing the style descriptor to load your custom sprites.

For more information, see [GetSprites](https://docs.aws.amazon.com/location/latest/APIReference/API_geomaps_GetSprites.html) in the *Amazon Location Service API Reference*.

## Use cases
<a name="use-cases"></a>
+ Rendering custom map elements using sprite sheets for specific styles and color schemes.
+ Fetching sprites for various map styles such as Standard, Monochrome, or Hybrid.
+ Customizing iconography on the map by modifying sprites.

## Understand the request
<a name="styling-understand-the-request"></a>

The request requires URI parameters such as `ColorScheme`, `FileName`, and `Style`. These parameters allow for the customization of the sprite sheet based on the map's color scheme, style, and the specific sprite file required.
+ **`ColorScheme`**: Defines the color scheme for the sprites, such as "Light" or "Dark".
+ **`FileName`**: The name of the sprite file to retrieve, which could be a PNG or JSON file.
+ **`Style`**: Specifies the map style, such as "Standard" or "Monochrome".

## Understand the response
<a name="styling-understand-the-response"></a>

The response contains headers such as `CacheControl`, `ContentType`, and `ETag`, and returns the sprite data as either a binary blob or a JSON file. These headers provide caching information, the content type of the response, and version control for the sprite data.
+ **`CacheControl`**: Caching configurations for the sprite file.
+ **`ContentType`**: The format of the response, indicating whether it contains PNG or JSON data.
+ **`ETag`**: Identifier for the sprite's version, used for cache validation.
+ **`Blob`**: Contains the body of the sprite sheet or the JSON offset file.

------
#### [ Standard Light ]

![\[Collection of colorful icons representing various services and concepts in cloud computing.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/styling-standard-light.png)


------
#### [ Standard Dark ]

![\[Collection of colorful icons and shapes representing various services and concepts.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/styling-standard-dark.png)


------
#### [ Monochrome Light ]

![\[Collection of various icons and shapes representing different concepts and services.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/styling-monochrome-light.png)


------
#### [ Monochrome Dark ]

![\[Collection of various icons and shapes representing different concepts and services.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/styling-monochrome-dark.png)


------
#### [ Hybrid ]

![\[Collection of colorful icons representing various travel, transportation, and service symbols.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/styling-hybrid.png)


------

# Style labels with glyphs
<a name="styling-labels-with-glyphs"></a>

Glyphs are binary files containing encoded Unicode characters, which are used by a map renderer to display labels. Amazon Location Service enables the retrieval of specific glyphs from a font stack for use in map rendering through the `GetGlyphs` API.

For more information, see [GetGlyphs](https://docs.aws.amazon.com/location/latest/APIReference/API_geomaps_GetGlyphs.html) in the *Amazon Location Service API Reference*.

## Use cases
<a name="glyphs-use-cases"></a>
+ Rendering custom text on maps with specific fonts and styles.
+ Fetching glyphs for localized map text rendering.
+ Using Unicode character ranges to display map labels and symbols.
+ Optimizing map font rendering based on font stacks and glyph ranges.

## Supported fonts in API
<a name="supported-fonts"></a>

The following fonts are supported in the API:
+ Amazon Ember Bold
+ Amazon Ember Bold Italic
+ Amazon Ember Bold,Noto Sans Bold
+ Amazon Ember Bold,Noto Sans Bold,Noto Sans Arabic Bold
+ Amazon Ember Condensed RC BdItalic
+ Amazon Ember Condensed RC Bold
+ Amazon Ember Condensed RC Bold Italic
+ Amazon Ember Condensed RC Bold,Noto Sans Bold
+ Amazon Ember Condensed RC Bold,Noto Sans Bold,Noto Sans Arabic Condensed Bold
+ Amazon Ember Condensed RC Light
+ Amazon Ember Condensed RC Light Italic
+ Amazon Ember Condensed RC LtItalic
+ Amazon Ember Condensed RC Regular
+ Amazon Ember Condensed RC Regular Italic
+ Amazon Ember Condensed RC Regular,Noto Sans Regular
+ Amazon Ember Condensed RC Regular,Noto Sans Regular,Noto Sans Arabic Condensed Regular
+ Amazon Ember Condensed RC RgItalic
+ Amazon Ember Condensed RC ThItalic
+ Amazon Ember Condensed RC Thin
+ Amazon Ember Condensed RC Thin Italic
+ Amazon Ember Heavy
+ Amazon Ember Heavy Italic
+ Amazon Ember Light
+ Amazon Ember Light Italic
+ Amazon Ember Medium
+ Amazon Ember Medium Italic
+ Amazon Ember Medium,Noto Sans Medium
+ Amazon Ember Medium,Noto Sans Medium,Noto Sans Arabic Medium
+ Amazon Ember Regular
+ Amazon Ember Regular Italic
+ Amazon Ember Regular Italic,Noto Sans Italic
+ Amazon Ember Regular Italic,Noto Sans Italic,Noto Sans Arabic Regular
+ Amazon Ember Regular,Noto Sans Regular
+ Amazon Ember Regular,Noto Sans Regular,Noto Sans Arabic Regular
+ Amazon Ember Thin
+ Amazon Ember Thin Italic
+ AmazonEmberCdRC\$1Bd
+ AmazonEmberCdRC\$1BdIt
+ AmazonEmberCdRC\$1Lt
+ AmazonEmberCdRC\$1LtIt
+ AmazonEmberCdRC\$1Rg
+ AmazonEmberCdRC\$1RgIt
+ AmazonEmberCdRC\$1Th
+ AmazonEmberCdRC\$1ThIt
+ AmazonEmber\$1Bd
+ AmazonEmber\$1BdIt
+ AmazonEmber\$1He
+ AmazonEmber\$1HeIt
+ AmazonEmber\$1Lt
+ AmazonEmber\$1LtIt
+ AmazonEmber\$1Md
+ AmazonEmber\$1MdIt
+ AmazonEmber\$1Rg
+ AmazonEmber\$1RgIt
+ AmazonEmber\$1Th
+ AmazonEmber\$1ThIt
+ Noto Sans Black
+ Noto Sans Black Italic
+ Noto Sans Bold
+ Noto Sans Bold Italic
+ Noto Sans Extra Bold
+ Noto Sans Extra Bold Italic
+ Noto Sans Extra Light
+ Noto Sans Extra Light Italic
+ Noto Sans Italic
+ Noto Sans Light
+ Noto Sans Light Italic
+ Noto Sans Medium
+ Noto Sans Medium Italic
+ Noto Sans Regular
+ Noto Sans Semi Bold
+ Noto Sans Semi Bold Italic
+ Noto Sans Thin
+ Noto Sans Thin Italic
+ NotoSans-Bold
+ NotoSans-Italic
+ NotoSans-Medium
+ NotoSans-Regular
+ Open Sans Regular,Arial Unicode MS Regular

## Understand the request
<a name="glyphs-understand-the-request"></a>

The request accepts two required URI parameters, `FontStack` and `FontUnicodeRange`, which determine the font and the Unicode range for glyphs. The `FontStack` parameter specifies which font to use, while the `FontUnicodeRange` defines the character range to fetch. The request does not include a body, focusing only on the URI parameters for its functionality.
+ **`FontStack`**: Specifies the name of the font stack to retrieve. Example: "Amazon Ember Bold, Noto Sans Bold".
+ **`FontUnicodeRange`**: A Unicode range of characters to download glyphs for. The range must be multiples of 256. Example: "0-255".

## Understand the response
<a name="glyphs-understand-the-response"></a>

The response returns glyph data as a binary blob, along with HTTP headers for caching, content type, ETag, and pricing information. The glyph data is returned as a binary blob to be rendered on maps, and the headers provide additional metadata for handling the response effectively.
+ **`CacheControl`**: Instructs the client on caching configurations for the response.
+ **`ContentType`**: Specifies the format of the response body, indicating the type of glyph data returned.
+ **`ETag`**: An identifier for the glyph's version, used for cache validation.
+ **`PricingBucket`**: Indicates the pricing tier associated with the request.
+ **`Blob`**: The glyph data returned as a binary blob, used to render map text.

# Static maps
<a name="static-maps"></a>

**Note**  
Static maps only support Standard and Satellite styles. For more information, see [AWS map styles and features](map-styles.md).

Static maps offer a pre-rendered representation of geographic data with the option to overlay markers (or pins), routes, and polygon areas, as needed for your application. The Static Map lets you generate static (non-interactive) map images based on customizable parameters and data inputs. By customizing overlays, shapes, or applying custom styles, Static Map enables you to create map visualizations that meet specific needs, enhancing the end-user experience and effectively communicating geographical information. The server customizes the requested map images and delivers them to the client as JPEG files. You can programmatically request and generate map images tailored to your specific requirements.

The *GetStaticMap API* generates a static image of a map based on specified parameters like center coordinates, bounding boxes, or overlays. The API allows customization of map features and style, enabling use in web or mobile applications without interactive map functionality.

For more information, see [GetStaticMap](https://docs.aws.amazon.com/location/latest/APIReference/API_geomaps_GetStaticMap.html) in the *Amazon Location Service API Reference*.

For example requests, responses, cURL, and CLI commands for this API, see [How to use Static maps](https://docs.aws.amazon.com/location/latest/developerguide/static-maps-how-to.html).

## Common use cases
<a name="static-maps-use-cases"></a>
+ **Embedded maps in web or mobile application:** Static map images can be efficiently embedded in websites or mobile applications to provide visualizations of locations, routes, or points of interest with non-interactive maps, reducing load times and data usage. Examples include search engines (such as Yahoo) showing map images with search results for POIs.
+ **Location details in e-mails:** Static map images can be used to share location information via email to help your end users understand the context of the email. For example, food delivery or ride-sharing apps use static map images to display pickup/drop-off locations, routes, or surrounding areas in post-trip or delivery emails containing bill and summary.
+ **Marketing materials and printed documents:** Customized static map images can be incorporated into brochures, flyers, or other printed materials, providing visually appealing representations of geographical information relevant to the content.

## Understand the request
<a name="static-maps-understanding-request"></a>

The request includes optional URI parameters, like `BoundedPositions`, `BoundingBox`, and `Center`, among others, to define the visible area and overlays of the map. The parameters `Height` and `Width` are required for defining the image size. To learn more, see [Customize static maps](customizing-static-maps.md) and [Overlay on the static map](overlaying-static-map.md).
+ `BoundedPositions`: Coordinates to encompass in the image.
+ `BoundingBox`: Coordinates defining the south-west and north-east edges of the map.
+ `Height`: Specifies the height of the image.
+ `Width`: Specifies the width of the image.
+ `GeoJsonOverlay`: A valid GeoJSON object for adding overlays.

## Understand the response
<a name="static-maps-understanding-response"></a>

The response contains headers like `CacheControl`, `ContentType`, and `ETag`, and returns the static map as a binary blob in either JPEG or PNG format. The headers provide metadata like cache control, content type, and version for static images.
+ `CacheControl`: Specifies caching configurations for the map image.
+ `ContentType`: Indicates the format of the map image (JPEG or PNG).
+ `ETag`: An identifier for the version of the static map image.
+ `Blob`: Represents the map image in either JPEG or PNG format.

# Customize static maps
<a name="customizing-static-maps"></a>

**Note**  
Static maps only support the Satellite style. For more information, see [AWS map styles and features](map-styles.md).

This section provides an overview of how to customize static maps generated using Amazon Location Service. It covers various features, such as adjusting the map's position, size, language, scale, overlays, and attribution, enabling you to tailor the map to your specific requirements.

For more information, see [GetStaticMap](https://docs.aws.amazon.com/location/latest/APIReference/API_geomaps_GetStaticMap.html) in the *Amazon Location Service API Reference*.

## Position
<a name="customizing-static-maps-position"></a>

The position allows you to define the center and boundaries of the map. You can control the map's focus by setting the center coordinates, a bounding box, or using a zoom level to determine how much area to display. To learn how it works, see [How to get a static map of a specific position](get-static-map-specific-position.md).
+ `Center`: Defines the center point of the map using longitude and latitude coordinates.
+ `Radius`: Specifies the radius (distance from the center) that will be displayed on the static map.
+ `Bounding Box`: Defines a rectangular area of the map, set by providing the coordinates of the top-left and bottom-right corners.
+ `Zoom`: Controls the zoom level of the map. Higher zoom levels show more detail in a smaller area, while lower zoom levels show less detail over a larger area.

## Dimension and quality
<a name="customizing-static-maps-dimension-quality"></a>

You can customize the size and visual quality of the static map by defining its dimensions (height and width) and adding padding for better presentation of markers and other elements. To learn how it works, see [How to get a static map of a specific dimension](get-static-map-specific-dimension.md).
+ `Height and Width`: Specifies the size of the static map image by defining its height and width in pixels.
+ `Padding`: Adds extra space around the edges of the map, allowing for better visualization when placing markers, lines, or shapes.

## Scale
<a name="customizing-static-maps-scale"></a>

The scale provides control over the scale of the map and defines the units (kilometers, miles) to measure distances. This is useful for accurately representing the map's size and distance relationships. To learn how it works, see [How to add scale for a static map](add-scale-static-map.md).
+ `Scale Unit`: Defines the units for the map's scale bar (for example, kilometers or miles), allowing users to accurately gauge distances on the map.

## Overlay
<a name="customizing-static-maps-overlay"></a>

You can add markers, lines to show routes, polygons to show areas, and more. To learn how it works, see [How to add a marker to a static map](add-marker-static-map.md), [How to add a line to a static map](how-to-add-line-static.md), or [How to add a route to a static map](how-to-add-route.md).

# Overlay on the static map
<a name="overlaying-static-map"></a>

This section explains how to overlay additional information onto static maps using Amazon Location Service. You can customize your static maps by adding various geographical features, such as points, lines, and polygons, to enhance the map's visual representation. Amazon Location Service supports multiple formats, including GeoJSON and a compact overlay format, to provide flexible and efficient ways of adding overlays.

For more information, see [GetStaticMap](https://docs.aws.amazon.com/location/latest/APIReference/API_geomaps_GetStaticMap.html) in the *Amazon Location Service API Reference*.

## With GeoJSON
<a name="overlaying-static-map-geojson"></a>

GeoJSON is a versatile format that allows you to overlay custom data on static maps. By defining geographical features such as points, lines, and polygons, you can enhance the visual representation of your maps, providing valuable context for users. GeoJSON is widely supported and offers flexibility when it comes to styling and customizing map overlays, making it an ideal format for displaying regions, plotting routes, or showing spatial relationships.

With Amazon Location Service, you can leverage GeoJSON to add dynamic, location-based features directly onto your static maps. This enables you to create highly customizable overlays that can be tailored to meet your specific business needs. GeoJSON supports several geometry types, including `Point`, `LineString`, `Polygon`, and `MultiPolygon`, allowing you to display a wide range of features, from markers and routes to complex area representations.

## Colors
<a name="overlaying-static-map-geojson-colors"></a>

When styling GeoJSON features, you have flexibility in defining colors. You can specify colors using different formats, such as hexadecimal values (like \$1ff0000 for red) or with alpha transparency (like \$1ff000080 for semi-transparent red). This ensures your overlays can be visually consistent with the map style. If no color is specified, the default color for the selected map style will be applied.

## Drawing order
<a name="overlaying-static-map-drawing-order"></a>

Custom overlays are drawn in a specific order to maintain clarity and avoid visual clutter. In Amazon Location Service, overlay features like polygons, lines, and points will appear above the base map, but below map labels. The drawing order prioritizes polygons first, followed by lines, and then points or markers.

## Measurement units
<a name="overlaying-static-map-measurement-units"></a>

For properties like `width` and `outline-width`, you can use different measurement units to specify size, including pixels (px), meters (m), kilometers (km), miles (mi), and percentages (%). The percentage unit adjusts the property relative to a default value, providing more flexibility in styling your overlays.

## Geometry types
<a name="overlaying-static-map-geometry-types"></a>

Amazon Location Service supports multiple GeoJSON geometry types, such as `Point`, `LineString`, `Polygon`, and `MultiPolygon`. Each geometry type can be styled and adjusted using the properties object in GeoJSON, allowing for extensive customization of markers, routes, and areas on your map.

## With compact overlay
<a name="overlaying-static-map-compact-overlay"></a>

**Note**  
Compact overlay supports the following geometry types: point, line, and polygon. It doesn't support `multiPoint`, `multiLine`, or `multiPolgyon`.

The compact overlay option allows you to efficiently display multiple geometries on a static map by using a single query parameter. This streamlined approach simplifies the request format and reduces the size of the request, making it easier to transmit overlay data. Customers can input various geometry types and their corresponding style properties in one query parameter, and Amazon Location Service will handle the heavy lifting by parsing and rendering the overlay as specified.

While using the compact overlay format, keep in mind that there are limits on the size of the request URL. Although Amazon Location Service optimizes the query, ensure that your request stays within reasonable limits, especially when dealing with multiple geometries and their associated properties.

## Format
<a name="overlaying-static-map-compact-overlay-format"></a>

The compact overlay format is structured as follows: `geometry_type:geometry;property_1=value_1;property_2=value_2|geometry_type:geometry;property_1=value_1...`

Each geometry type is defined along with its style properties. Multiple geometries are separated by a pipe operator (\$1), and properties for each geometry are separated using a semicolon.

## Supported geometry types
<a name="overlaying-static-map-supported-geometry-types"></a>

Amazon Location Service supports several geometry types, including `Point`, `MultiPoint`, `LineString`, `Polygon`, and `MultiPolygon`. These geometry types can be combined and styled within the same query parameter using the compact overlay format.

## Styling properties
<a name="overlaying-static-map-styling-properties"></a>

Each geometry can be customized using various style properties, such as color, outline color, size, and more. These properties allow you to control the appearance of each geometry on the map, ensuring that the overlay aligns with your business requirements.

# How to
<a name="maps-how-to"></a>

This section contains a variety of how to guides and examples for how to use Maps APIs.

**Topics**
+ [

# How to use dynamic maps
](dynamic-maps-how-to.md)
+ [

# How to use static maps
](static-maps-how-to.md)

# How to use dynamic maps
<a name="dynamic-maps-how-to"></a>

These how-to topics offer a comprehensive walkthrough teaching you how to enhance your mapping applications using the Amazon Location Service. From displaying interactive maps to adding markers, lines, and polygons, these tutorials demonstrate how to utilize essential features like setting map controls, adding custom icons, and handling real-time data. Furthermore, the topics also cover localization and internationalization aspects, such as setting preferred languages, adjusting political views, and ensuring compliance with regional laws by customizing map content based on the user’s location or perspective.

Each how-to is designed to be accessible, with step-by-step instructions for implementing these features in web applications using MapLibre GL JS. Whether your goal is to build a dynamic map experience with custom icons and popups or to tailor map views for specific political perspectives and languages, these examples will help you achieve your objectives while ensuring a rich, localized mapping experience for users across different regions. These tutorials ensure that you can fully leverage the capabilities of Amazon Location Service, from basic mapping functions to complex geopolitical and localization needs.

**Topics**
+ [

# How to display a map
](how-to-display-a-map.md)
+ [

# How to add control on the map
](how-to-add-control-on-map.md)
+ [

# How to add a marker on the map
](how-to-add-marker-on-map.md)
+ [

# How to add an icon on the map
](how-to-add-icon-on-map.md)
+ [

# How to add a line on the map
](how-to-add-line-on-map.md)
+ [

# How to add a polygon on the map
](how-to-add-polygon-on-map.md)
+ [

# How to add a popup to a map
](how-to-add-popup-to-map.md)
+ [

# How to set a preferred language for a map
](how-to-set-preferred-language-map.md)
+ [

# How to set the political view of a map
](how-to-set-political-view-map.md)
+ [

# How to filter POI on the map
](how-to-filter-poi-map.md)
+ [

# How to create topographic maps
](how-to-create-topographic-maps.md)
+ [

# How to show real-time traffic on a map
](how-to-set-real-time-traffic-map.md)
+ [

# How to create a logistics map
](how-to-create-logistic-map.md)
+ [

# How to show transit details on a map
](how-to-show-transit-details-map.md)
+ [

# How to create a 3D map
](how-to-create-a-3d-map.md)

# How to display a map
<a name="how-to-display-a-map"></a>

Amazon Location Service allows you to display both interactive and non-interactive maps using our map styles. See [AWS map styles and features](map-styles.md) to learn more.

## Interactive map
<a name="interactive-map"></a>

In this example, you will display an interactive map that allows users to zoom, pan, pinch, and pitch.

### Interactive map code example
<a name="interactive-map-web-code"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Display a map</title>
        <meta property="og:description" content="Initialize a map in an HTML element with MapLibre GL JS." />
        <meta charset='utf-8'>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
        <link rel='stylesheet' href='style.css' />
        <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
    </head>
    <body>
        <!-- Map container -->
        <div id="map"></div>
        <script>
            const apiKey = "<API_KEY>";
            const mapStyle = "Standard"; // e.g., Standard, Monochrome, Hybrid, Satellite
            const awsRegion = "eu-central-1"; // e.g., us-east-2, us-east-1, us-west-2, etc.
            const styleUrl = `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?key=${apiKey}`;

            const map = new maplibregl.Map({
                container: 'map', // container id
                style: styleUrl, // style URL
                center: [25.24, 36.31], // starting position [lng, lat]
                zoom: 2, // starting zoom
            });
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
```

------

## Restrict map panning beyond an area
<a name="restrict-map-panning"></a>

In this example, you will restrict the map from being panned beyond a defined boundary.

### Restrict map panning code example
<a name="restrict-map-panning-web-code"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Display a map</title>
        <meta property="og:description" content="Initialize a map in an HTML element with MapLibre GL JS." />
        <meta charset='utf-8'>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
        <link rel='stylesheet' href='style.css' />
        <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
    </head>
    <body>
        <!-- Map container -->
        <div id="map"></div>
        <script>
            const apiKey = "<API_KEY>";
            const mapStyle = "Standard"; // e.g., Standard, Monochrome, Hybrid, Satellite
            const awsRegion = "eu-central-1"; // e.g., us-east-2, us-east-1, us-west-2, etc.
            const styleUrl = `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?key=${apiKey}`;

            var bounds = [
                [90.0, -21.943045533438166], // Southwest coordinates
                [146.25, 31.952162238024968] // Northeast coordinates
            ];

            const map = new maplibregl.Map({
                container: 'map', // container id
                style: styleUrl, // style URL
                maxBounds: bounds, // Sets bounds of SE Asia
            });
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
```

------

## Non-interactive map
<a name="non-interactive-map"></a>

In this example, you will display a non-interactive map by disabling user interaction.

### Non-interactive map code example
<a name="non-interactive-map-web-code"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Display a map</title>
        <meta property="og:description" content="Initialize a map in an HTML element with MapLibre GL JS." />
        <meta charset='utf-8'>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
        <link rel='stylesheet' href='style.css' />
        <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
    </head>
    <body>
        <!-- Map container -->
        <div id="map"></div>
        <script>
            const apiKey = "<API_KEY>";
            const mapStyle = "Standard"; // e.g., Standard, Monochrome, Hybrid, Satellite
            const awsRegion = "eu-central-1"; // e.g., us-east-2, us-east-1, us-west-2, etc.
            const styleUrl = `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?key=${apiKey}`;

            const map = new maplibregl.Map({
                container: 'map', // container id
                style: styleUrl, // style URL
                center: [25.24, 36.31], // starting position [lng, lat]
                zoom: 2, // starting zoom
                interactive: false, // Disable pan & zoom handlers
            });
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
```

------

# How to add control on the map
<a name="how-to-add-control-on-map"></a>

Amazon Location Service allows you to add multiple controls to the map, including navigation, geolocation, fullscreen, scale, and attribution controls.
+ **Navigation control**: Contains zoom buttons and a compass.
+ **Geolocate control**: Provides a button that uses the browser's geolocation API to locate the user on the map.
+ **Fullscreen control**: Contains a button for toggling the map in and out of fullscreen mode.
+ **Scale control**: Displays the ratio of a distance on the map to the corresponding distance on the ground.
+ **Attribution control**: Presents the map's attribution information. By default, the attribution control is expanded (regardless of map width).

You can add the controls to any corner of the map: top-left, bottom-left, bottom-right, or top-right.

## Adding map controls
<a name="add-map-controls"></a>

In the following example, you'll add the map controls listed above.

### Map control code example
<a name="web-code-example"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Map Controls</title>
        <meta property="og:description" content="Initialize a map in an HTML element with MapLibre GL JS." />
        <meta charset='utf-8'>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
        <link rel='stylesheet' href='style.css' />
        <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
    </head>
    <body>
        <!-- Map container -->
        <div id="map"></div>
        <script>
            const apiKey = "<API_KEY>";
            const mapStyle = "Standard"; // e.g., Standard, Monochrome, Hybrid, Satellite
            const awsRegion = "eu-central-1"; // e.g., us-east-2, us-east-1, us-west-2, etc.
            const styleUrl = `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?key=${apiKey}`;

            const map = new maplibregl.Map({
                container: 'map', // container id
                style: styleUrl, // style URL
                center: [-123.13203602550998, 49.28726257639254], // starting position [lng, lat]
                zoom: 10, // starting zoom
                attributionControl: false, // hide default attributionControl in bottom left
            });

            // Adding controls to the map
            map.addControl(new maplibregl.NavigationControl()); // Zoom and rotation controls
            map.addControl(new maplibregl.FullscreenControl()); // Fullscreen control
            map.addControl(new maplibregl.GeolocateControl()); // Geolocation control
            map.addControl(new maplibregl.AttributionControl(), 'bottom-left'); // Attribution in bottom-left
            map.addControl(new maplibregl.ScaleControl(), 'bottom-right'); // Scale control in bottom-right
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
```

------

## Developer tips
<a name="developer-tips"></a>

### Navigation control options
<a name="navigationcontrol-options"></a>

```
new maplibregl.NavigationControl({ 
    showCompass: true, // show or hide compass (default: true)
    showZoom: true // show or hide zoom controls (default: true)
});
```

### Geolocate control options
<a name="geolocatecontrol-options"></a>

```
new maplibregl.GeolocateControl({ 
    positionOptions: { enableHighAccuracy: true }, // default: false
    trackUserLocation: true // default: false
});
```

### Attribution control options
<a name="attributioncontrol-options"></a>

```
new maplibregl.AttributionControl({
    compact: true, // compact (collapsed) mode (default: false)
});
```

### Scale control options
<a name="scalecontrol-options"></a>

```
new maplibregl.ScaleControl({ 
    maxWidth: 100, // width of the scale (default: 50)
    unit: 'imperial' // imperial or metric (default: metric)
});
```

### Fullscreen control options
<a name="fullscreencontrol-options"></a>

```
map.addControl(new maplibregl.FullscreenControl({
    container: document.querySelector('body') // container for fullscreen mode
}));
```

# How to add a marker on the map
<a name="how-to-add-marker-on-map"></a>

With Amazon Location, you can add both fixed and draggable markers, and you can also customize the color of the markers based on your data and preferences.

## Add a fixed marker
<a name="add-marker"></a>

### Fixed marker code example
<a name="web-code-example-fixed-marker"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Add marker on a map</title>
        <meta property="og:description" content="Initialize a map in an HTML element with MapLibre GL JS." />
        <meta charset='utf-8'>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
        <link rel='stylesheet' href='style.css' />
        <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
    </head>
    <body>
        <!-- Map container -->
        <div id="map"></div>
        <script>
            const apiKey = "<API_KEY>";
            const mapStyle = "Standard";  // e.g., Standard, Monochrome, Hybrid, Satellite  
            const awsRegion = "eu-central-1"; // e.g., us-east-2, us-east-1, us-west-2, etc.
            const styleUrl = `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?key=${apiKey}`;

            const map = new maplibregl.Map({
                container: 'map', // container id
                style: styleUrl, // style URL
                center: [0, 0], // starting position [lng, lat]
                zoom: 1, // starting zoom
            });

            const marker = new maplibregl.Marker() // Create fixed marker
                .setLngLat([85.1376, 25.5941]) // Set coordinates [long, lat] for marker (e.g., Patna, BR, IN)
                .addTo(map); // Add marker to the map
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
```

------

## Add a draggable marker
<a name="add-draggable-marker"></a>

### Draggable marker code example
<a name="web-code-example-draggable-marker"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Add draggable marker on a map</title>
        <meta property="og:description" content="Initialize a map in an HTML element with MapLibre GL JS." />
        <meta charset='utf-8'>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
        <link rel='stylesheet' href='style.css' />
        <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
    </head>
    <body>
        <!-- Map container -->
        <div id="map"></div>
        <script>
            const apiKey = "<API_KEY>";
            const mapStyle = "Standard";  // e.g., Standard, Monochrome, Hybrid, Satellite  
            const awsRegion = "eu-central-1"; // e.g., us-east-2, us-east-1, us-west-2, etc.
            const styleUrl = `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?key=${apiKey}`;

            const map = new maplibregl.Map({
                container: 'map', // container id
                style: styleUrl, // style URL
                center: [0, 0], // starting position [lng, lat]
                zoom: 1, // starting zoom
            });

            const marker = new maplibregl.Marker({ draggable: true }) // Create draggable marker
                .setLngLat([85.1376, 25.5941]) // Set coordinates [long, lat] for marker (e.g., Patna, BR, IN)
                .addTo(map); // Add marker to the map
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
```

------

## Changing marker color
<a name="change-marker-color"></a>

### Colorful marker code example
<a name="web-code-example-change-marker-color"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Adding colorful marker on a map</title>
        <meta property="og:description" content="Initialize a map in an HTML element with MapLibre GL JS." />
        <meta charset='utf-8'>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
        <link rel='stylesheet' href='style.css' />
        <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
    </head>
    <body>
        <!-- Map container -->
        <div id="map"></div>
        <script>
            const apiKey = "<API_KEY>";
            const mapStyle = "Monochrome";  // e.g., Standard, Monochrome, Hybrid, Satellite  
            const awsRegion = "eu-central-1"; // e.g., us-east-2, us-east-1, us-west-2, etc.
            const styleUrl = `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?key=${apiKey}`;

            const map = new maplibregl.Map({
                container: 'map', // container id
                style: styleUrl, // style URL
                center: [0, 0], // starting position [lng, lat]
                zoom: 1, // starting zoom
            });

            const marker = new maplibregl.Marker({ color: "black" }) // Create colored marker
                .setLngLat([85.1376, 25.5941]) // Set coordinates [long, lat] for marker (e.g., Patna, BR, IN)
                .addTo(map); // Add marker to the map
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
```

------

## Add multiple markers
<a name="add-multiple-markers"></a>

### Multiple markers code example
<a name="web-code-example-multiple-markers"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Adding multiple markers on a map</title>
        <meta property="og:description" content="Initialize a map in an HTML element with MapLibre GL JS." />
        <meta charset='utf-8'>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
        <link rel='stylesheet' href='style.css' />
        <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
    </head>
    <body>
        <!-- Map container -->
        <div id="map"></div>
        <script>
            const apiKey = "<API_KEY>";
            const mapStyle = "Standard";  // e.g., Standard, Monochrome, Hybrid, Satellite  
            const awsRegion = "eu-central-1"; // e.g., us-east-2, us-east-1, us-west-2, etc.
            const colorScheme ="Dark"; // e.g., Dark, Light (default)
            const styleUrl = `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?color-scheme=${colorScheme}&key=${apiKey}`;

            const map = new maplibregl.Map({
                container: 'map', // container id
                style: styleUrl, // style URL
                center: [0, 0], // starting position [lng, lat]
                zoom: 1, // starting zoom
            });

            const locations = [
                { lng: 85.1376, lat: 25.5941, label: 'Patna', color: '#FF5722' }, 
                { lng: 77.1025, lat: 28.7041, label: 'Delhi', color: '#2196F3' }, 
                { lng: 77.5946, lat: 12.9716, label: 'Bangalore', color: '#FF9800' }, 
                { lng: 78.4867, lat: 17.3850, label: 'Hyderabad', color: '#9C27B0' }, 
                { lng: -87.6298, lat: 41.8781, label: 'Chicago', color: '#4CAF50' }, 
                { lng: -122.3321, lat: 47.6062, label: 'Seattle', color: '#FFC107' }, 
                { lng: 4.3517, lat: 50.8503, label: 'Brussels', color: '#3F51B5' },   
                { lng: 2.3522, lat: 48.8566, label: 'Paris', color: '#E91E63' },   
                { lng: -0.1276, lat: 51.5074, label: 'London', color: '#795548' },  
                { lng: 28.0473, lat: -26.2041, label: 'Johannesburg', color: '#673AB7' },  
                { lng: -123.1216, lat: 49.2827, label: 'Vancouver', color: '#FF5722' }, 
                { lng: -104.9903, lat: 39.7392, label: 'Denver', color: '#FF9800' }, 
                { lng: -97.7431, lat: 30.2672, label: 'Austin', color: '#3F51B5' }  
            ];

            // Loop through the locations array and add a marker for each one
            locations.forEach(location => {           
                const marker = new maplibregl.Marker({ color: location.color, draggable: true }) // Create colored marker
                    .setLngLat([location.lng, location.lat]) // Set longitude and latitude
                    .addTo(map); // Add marker to the map
            }); 
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
```

------

# How to add an icon on the map
<a name="how-to-add-icon-on-map"></a>

Amazon Location Service enables you to add icons, preferably in PNG format, to the map. You can add icons to specific geolocations and style them as needed.

## Add a static icon
<a name="add-static-icon"></a>

In this example, you will use an external URL to add an icon to the map using a symbol layer.

### Static icon code example
<a name="web-code-example-static-icon"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Static icon on map</title>
        <meta property="og:description" content="Initialize a map in an HTML element with MapLibre GL JS." />
        <meta charset='utf-8'>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
        <link rel='stylesheet' href='style.css' />
        <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
    </head>
    <body>
        <!-- Map container -->
        <div id="map"></div>
        <script>
            const apiKey = "<API_KEY>";
            const mapStyle = "Standard";  // e.g., Standard, Monochrome, Hybrid, Satellite  
            const awsRegion = "eu-central-1"; // e.g., us-east-2, us-east-1, us-west-2, etc.
            const styleUrl = `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?key=${apiKey}`;

            const map = new maplibregl.Map({
                container: 'map', // container id
                style: styleUrl, // style URL
                center: [-123.1144289, 49.2806672], // starting position [lng, lat] (e.g., Vancouver)
                zoom: 12, // starting zoom
            });

            map.on('load', async () => {
                image = await map.loadImage('https://upload.wikimedia.org/wikipedia/commons/1/1e/Biking_other.png');
                map.addImage('biking', image.data);
                map.addSource('point', {
                    'type': 'geojson',
                    'data': {
                        'type': 'FeatureCollection',
                        'features': [
                            {
                                'type': 'Feature',
                                'geometry': {
                                    'type': 'Point',
                                    'coordinates': [-123.1144289, 49.2806672]
                                }
                            }
                        ]
                    }
                });
                map.addLayer({
                    'id': 'points',
                    'type': 'symbol',
                    'source': 'point',
                    'layout': {
                        'icon-image': 'biking',
                        'icon-size': 0.25
                    }
                });
            });
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
```

------

# How to add a line on the map
<a name="how-to-add-line-on-map"></a>

With Amazon Location Service, you can add both pre-recorded GPS traces as line-strings and real-time GPS traces to dynamic maps.

## Adding a pre-recorded line
<a name="add-pre-recorded-line"></a>

In this example, you will add a pre-recorded GPS trace as a GeoJSON (main.js) to the dynamic map. To do so, you need to add a source (like GeoJSON) and a layer with line styling of your choice to the map. 

### Pre-recorded line code example
<a name="web-code-example-pre-recorded-line"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Add a line on the map</title>
        <meta property="og:description" content="Initialize a map in an HTML element with MapLibre GL JS." />
        <meta charset='utf-8'>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
        <link rel='stylesheet' href='style.css' />
        <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
        <script src='main.js'></script>
    </head>
    <body>
        <!-- Map container -->
        <div id="map"></div>
        <script>
            const apiKey = "<API_KEY>";
            const mapStyle = "Standard";
            const awsRegion = "eu-central-1";
            const styleUrl = `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?key=${apiKey}`;

            const map = new maplibregl.Map({
                container: 'map',
                style: styleUrl,
                center: [-123.126575, 49.290585],
                zoom: 12.5
            });

            map.on('load', () => {
                map.addSource('vancouver-office-to-stanley-park-route', {
                    type: 'geojson',
                    data: routeGeoJSON
                });

                map.addLayer({
                    id: 'vancouver-office-to-stanley-park-route',
                    type: 'line',
                    source: 'vancouver-office-to-stanley-park-route',
                    layout: {
                        'line-cap': 'round',
                        'line-join': 'round'
                    },
                    paint: {
                        'line-color': '#008296',
                        'line-width': 2
                    }
                });
            });
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
```

------
#### [ main.js ]

```
const routeGeoJSON = {
    type: "FeatureCollection",
    features: [
        {
            type: "Feature",
            geometry: {
                type: "LineString",
                coordinates: [
                    [-123.117011, 49.281306],
                    [-123.11785, 49.28011],
                    ...
                    [-123.135735, 49.30106]
                ]
            },
            properties: {
                name: "Amazon YVR to Stanley Park",
                description: "An evening walk from Amazon office to Stanley Park."
            }
        }
    ]
};
```

------

## Add a line in real-time
<a name="add-real-time-line"></a>

In this example, you will simulate adding new GPS coordinates one by one to create a real-time GPS trace. This is useful for tracking real-time data updates.

### Real-time line code example
<a name="web-code-example-real-time-line"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Add a line on the map in real-time</title>
        <meta property="og:description" content="Initialize a map in an HTML element with MapLibre GL JS." />
        <meta charset='utf-8'>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
        <link rel='stylesheet' href='style.css' />
        <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
        <script src='main.js'></script>
    </head>
    <body>
        <!-- Map container -->
        <div id="map"></div>
        <script>
            const apiKey = "<API_KEY>";
            const mapStyle = "Standard";
            const awsRegion = "eu-central-1";
            const styleUrl = `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?key=${apiKey}`;

            const map = new maplibregl.Map({
                container: 'map',
                style: styleUrl,
                center: [-123.126575, 49.290585],
                zoom: 12.5
            });

            map.on('load', () => {
                const coordinates = routeGeoJSON.features[0].geometry.coordinates;
                routeGeoJSON.features[0].geometry.coordinates = [coordinates[0], coordinates[20]];

                map.addSource('vancouver-office-to-stanley-park-route', {
                    type: 'geojson',
                    data: routeGeoJSON
                });

                map.addLayer({
                    id: 'vancouver-office-to-stanley-park-route',
                    type: 'line',
                    source: 'vancouver-office-to-stanley-park-route',
                    layout: {
                        'line-cap': 'round',
                        'line-join': 'round'
                    },
                    paint: {
                        'line-color': '#008296',
                        'line-width': 2
                    }
                });

                map.jumpTo({center: coordinates[0], zoom: 14});
                map.setPitch(30);

                let i = 0;
                const timer = window.setInterval(() => {
                    if (i < coordinates.length) {
                        routeGeoJSON.features[0].geometry.coordinates.push(coordinates[i]);
                        map.getSource('vancouver-office-to-stanley-park-route').setData(routeGeoJSON);
                        map.panTo(coordinates[i]);
                        i++;
                    } else {
                        window.clearInterval(timer);
                    }
                }, 100);
            });
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
```

------
#### [ main.js ]

```
const routeGeoJSON = {
    type: "FeatureCollection",
    features: [
        {
            type: "Feature",
            geometry: {
                type: "LineString",
                coordinates: [
                    [-123.117011, 49.281306],
                    [-123.11785, 49.28011],
                    ...
                    [-123.135735, 49.30106]
                ]
            },
            properties: {
                name: "Amazon YVR to Stanley Park",
                description: "An evening walk from Amazon office to Stanley Park."
            }
        }
    ]
};
```

------

## Developer tips
<a name="developer-tips"></a>

**Fitting bounds:** You can fit the line to the map bounds by calculating the bounds of the line's coordinates:

```
const coordinates = routeGeoJSON.features[0].geometry.coordinates;
const bounds = coordinates.reduce((bounds, coord) => bounds.extend(coord), new maplibregl.LngLatBounds(coordinates[0], coordinates[0]));
map.fitBounds(bounds, { padding: 20 });
```

# How to add a polygon on the map
<a name="how-to-add-polygon-on-map"></a>

Amazon Location Service allows you to add polygons to the map. You can style the polygon based on your business needs, including adding fill and border styling.

## Add a polygon
<a name="add-polygon"></a>

In this example, you will add a polygon to the map and style it with a fill color and a border.

### Polygon code example
<a name="web-code-example-polygon"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Overlay a Polygon on a Map</title>
        <meta property="og:description" content="Initialize a map in an HTML element with MapLibre GL JS." />
        <meta charset='utf-8'>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
        <link rel='stylesheet' href='style.css' />
        <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
        <script src='main.js'></script>
    </head>
    <body>
        <!-- Map container -->
        <div id="map"></div>
        <script>
            const apiKey = "<API_KEY>";
            const mapStyle = "Standard";
            const awsRegion = "eu-central-1";
            const styleUrl = `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?key=${apiKey}`;

            const map = new maplibregl.Map({
                container: 'map',
                style: styleUrl,
                center: [-123.13203602550998, 49.28726257639254],
                zoom: 16
            });

            map.on('load', () => {
                map.addSource('barclayHeritageSquare', {
                    type: 'geojson',
                    data: barclayHeritageSquare
                });

                map.addLayer({
                    id: 'barclayHeritageSquare-fill',
                    type: 'fill',
                    source: 'barclayHeritageSquare',
                    layout: {},
                    paint: {
                        'fill-color': '#008296',
                        'fill-opacity': 0.25
                    }
                });

                map.addLayer({
                    id: 'barclayHeritageSquare-outline',
                    type: 'line',
                    source: 'barclayHeritageSquare',
                    layout: {},
                    paint: {
                        'line-color': '#008296',
                        'line-width': 2
                    }
                });
            });
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
```

------
#### [ main.js ]

```
const barclayHeritageSquare = {
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "properties": {
                "park_id": 200,
                "park_name": "Barclay Heritage Square",
                "area_ha": 0.63255076039675,
                "park_url": "http://covapp.vancouver.ca/parkfinder/parkdetail.aspx?inparkid=200"
            },
            "geometry": {
                "type": "MultiPolygon",
                "coordinates": [
                    [
                        [-123.1320948511985, 49.287379401361406],
                        [-123.13179672786798, 49.2871908081159],
                        [-123.13148154587924, 49.28739992437733],
                        [-123.1313830551372, 49.28733617069321],
                        [-123.13118648745055, 49.287208851500054],
                        [-123.13128257706838, 49.28714532642171],
                        [-123.13147941881572, 49.28727228533418],
                        ...
                        [-123.13177619357138, 49.28759081706052],
                        [-123.1320948511985, 49.287379401361406]
                    ]
                ]
            }
        }
    ]
};
```

------

# How to add a popup to a map
<a name="how-to-add-popup-to-map"></a>

Amazon Location Service allows you to add popups to the map. You can add simple popups, click-triggered popups on markers, hover-triggered popups, and popups for multiple markers. 

## Add your first popup
<a name="add-first-popup"></a>

In this example, you will add your first popup.

### First popup code example
<a name="first-popup-web"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Display a map</title>
        <meta property="og:description" content="Initialize a map in an HTML element with MapLibre GL JS." />
        <meta charset='utf-8'>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
        <link rel='stylesheet' href='style.css' />
        <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
    </head>
    <body>
        <!-- Map container -->
        <div id="map"></div>
        <script>
            const apiKey = "<API_KEY>";
            const mapStyle = "Standard";
            const awsRegion = "eu-central-1";
            const styleUrl = `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?key=${apiKey}`;

            const map = new maplibregl.Map({
                container: 'map',
                style: styleUrl,
                center: [-96, 37.8],
                zoom: 2
            });

            const popup = new maplibregl.Popup({closeOnClick: false})
                .setLngLat([-96, 37.8])
                .setHTML('<h1>Hello USA!</h1>')
                .addTo(map);
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
```

------

## Show popup on click on a marker
<a name="show-popup-on-click"></a>

In this example, you will attach a popup to a marker and display it on click.

### Popup on marker click example
<a name="click-popup-web"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Display a map</title>
        <meta property="og:description" content="Initialize a map in an HTML element with MapLibre GL JS." />
        <meta charset='utf-8'>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
        <link rel='stylesheet' href='style.css' />
        <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
    </head>
    <body>
        <!-- Map container -->
        <div id="map"></div>
        <script>
            const apiKey = "<API_KEY>";
            const mapStyle = "Standard";
            const awsRegion = "eu-central-1";
            const styleUrl = `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?key=${apiKey}`;

            const centralpark_nyc = [-73.966,40.781];
            const map = new maplibregl.Map({
                container: 'map',
                style: styleUrl,
                center: centralpark_nyc,
                zoom: 13
            });

            const popup = new maplibregl.Popup({offset: 25}).setText(
                'Central Park, NY is one of the most filmed locations in the world, appearing in over 240 feature films since 1908.'
            );

            new maplibregl.Marker()
                .setLngLat(centralpark_nyc)
                .setPopup(popup)
                .addTo(map);
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
```

------

## Show popup on hover on a marker
<a name="show-popup-on-hover"></a>

In this example, you will attach a popup to a marker and display it on hover.

### Popup on marker hover example
<a name="hover-popup-web"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Display a map</title>
        <meta property="og:description" content="Initialize a map in an HTML element with MapLibre GL JS." />
        <meta charset='utf-8'>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
        <link rel='stylesheet' href='style.css' />
        <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
    </head>
    <body>
        <!-- Map container -->
        <div id="map"></div>
        <script>
            const apiKey = "<API_KEY>";
            const mapStyle = "Standard";
            const awsRegion = "eu-central-1";
            const styleUrl = `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?key=${apiKey}`;

            const centralpark_nyc = [-73.966,40.781];
            const map = new maplibregl.Map({
                container: 'map',
                style: styleUrl,
                center: centralpark_nyc,
                zoom: 13
            });

            const marker = new maplibregl.Marker().setLngLat([-73.968285, 40.785091]).addTo(map);
            const popup = new maplibregl.Popup({ offset: 25 })
                .setHTML("<h3>Central Park</h3><p>Welcome to Central Park, NYC!</p>");

            const markerElement = marker.getElement();
            markerElement.addEventListener('mouseenter', () => {
                popup.setLngLat([-73.968285, 40.785091]).addTo(map);
            });
            markerElement.addEventListener('mouseleave', () => {
                popup.remove();
            });
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
```

------

## Show popup on click on multiple markers
<a name="popup-on-multiple-markers"></a>

In this example, you will attach a popup to multiple markers and display it on click.

### Popup on click on multiple markers example
<a name="popup-on-multiple-markers-code"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Display a map</title>
        <meta property="og:description" content="Initialize a map in an HTML element with MapLibre GL JS." />
        <meta charset='utf-8'>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
        <link rel='stylesheet' href='style.css' />
        <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
    </head>
    <body>
        <!-- Map container -->
        <div id="map"></div>
        <script>
            const apiKey = "Your API Key";
            const mapStyle = "Monochrome";  
            const awsRegion = "eu-central-1";
            const colorScheme ="Light";
            const styleUrl = `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?color-scheme=${colorScheme}&key=${apiKey}`;

            const map = new maplibregl.Map({
                container: 'map', 
                style: styleUrl, 
                center: [-123.126979, 49.2841563],
                zoom: 15,
                minZoom: 13,
                maxZoom: 17
            });

            const locations = [
                { id: 1, lat: 49.281108, lng: -123.117049, name: "Amazon - YVR11 office" },
                { id: 2, lat: 49.285580, lng: -123.115806, name: "Amazon - YVR20 office" },
                { id: 3, lat: 49.281661, lng: -123.114174, name: "Amazon - YVR14 office" },
                { id: 4, lat: 49.280663, lng: -123.114379, name: "Amazon - YVR26 office" },
                { id: 5, lat: 49.285343, lng: -123.129119, name: "Amazon - YVR25 office" }
            ];

            const geojson = {
                type: "FeatureCollection",
                features: locations.map(location => ({
                    type: "Feature",
                    properties: { id: location.id, name: location.name },
                    geometry: {
                        type: "Point",
                        coordinates: [location.lng, location.lat]
                    }
                }))
            };
            
            map.on('load', async () => {
                try {
                    const image = await loadImage('https://upload.wikimedia.org/wikipedia/commons/thumb/9/93/Amazon_Web_Services_Logo.svg/1200px-Amazon_Web_Services_Logo.svg.png');
                    map.addImage('aws', image);

                    map.addSource('places', { type: 'geojson', data: geojson });

                    map.addLayer({
                        'id': 'places',
                        'type': 'symbol',
                        'source': 'places',
                        'layout': {
                            'icon-image': 'aws',
                            'icon-size': 0.025,
                            'icon-allow-overlap': true
                        }
                    });

                    const popup = new maplibregl.Popup({ closeButton: false, closeOnClick: false });

                    map.on('click', 'places', (e) => {
                        map.getCanvas().style.cursor = 'pointer';
                        const coordinates = e.features[0].geometry.coordinates.slice();
                        const name = e.features[0].properties.name;
                        popup.setLngLat(coordinates).setHTML(name).addTo(map);
                    });

                    map.on('mouseleave', 'places', () => {
                        map.getCanvas().style.cursor = '';
                        popup.remove();
                    });
                } catch (error) {
                    console.error('Error loading image:', error);
                }
            });

            async function loadImage(url) {
                return new Promise((resolve, reject) => {
                    const img = new Image();
                    img.crossOrigin = 'anonymous';
                    img.onload = () => resolve(img);
                    img.onerror = (error) => reject(error);
                    img.src = url;
                });
            }
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
```

------

## Show popup on hover on multiple markers
<a name="popup-on-hover-multiple-markers"></a>

In this example, you will attach a popup to multiple markers and display it on hover.

### Popup on hover on multiple markers example
<a name="popup-on-hover-multiple-markers-code"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Display a map</title>
        <meta property="og:description" content="Initialize a map in an HTML element with MapLibre GL JS." />
        <meta charset='utf-8'>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
        <link rel='stylesheet' href='style.css' />
        <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
    </head>
    <body>
        <!-- Map container --> 
        <div id="map" style="width: 100%; height: 100vh;"></div>
        <script>
            const apiKey = "You API Key";
            const mapStyle = "Monochrome";  // eg. Standard, Monochrome, Hybrid, Satellite  
            const awsRegion = "eu-central-1"; // eg. us-east-2, us-east-1, etc.
            const colorScheme ="Light"; // eg Dark, Light (default)
            const styleUrl = `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?color-scheme=${colorScheme}&key=${apiKey}`;

            // Initialize the map
            const map = new maplibregl.Map({
                container: 'map', // Container id
                style: styleUrl, // Style URL
                center: [-123.126979, 49.2841563], // Starting position [lng, lat]
                zoom: 15, // Starting zoom
                minZoom: 13, // Minimum zoom level
                maxZoom: 17 // Maximum zoom level
            });

            const locations = [
                { id: 1, lat: 49.281108, lng: -123.117049, name: "Amazon - YVR11 office" },
                { id: 2, lat: 49.285580, lng: -123.115806, name: "Amazon - YVR20 office" },
                { id: 3, lat: 49.281661, lng: -123.114174, name: "Amazon - YVR14 office" },
                { id: 4, lat: 49.280663, lng: -123.114379, name: "Amazon - YVR26 office" },
                { id: 5, lat: 49.285343, lng: -123.129119, name: "Amazon - YVR25 office" }
            ];

            // Convert locations to GeoJSON
            const geojson = {
                type: "FeatureCollection",
                features: locations.map(location => ({
                    type: "Feature",
                    properties: { 
                        id: location.id,
                        name: location.name // Use the name property for popup
                    },
                    geometry: {
                        type: "Point",
                        coordinates: [location.lng, location.lat] // GeoJSON uses [lng, lat]
                    }
                }))
            };
            
            // Add the GeoJSON source and layers when the map loads
            map.on('load', async () => {
                try {
                    // Load the PNG image for the marker
                    const image = await loadImage('https://upload.wikimedia.org/wikipedia/commons/thumb/9/93/Amazon_Web_Services_Logo.svg/1200px-Amazon_Web_Services_Logo.svg.png'); // Ensure this URL points to a valid PNG
                    map.addImage('aws', image);

                    // Add a GeoJSON source
                    map.addSource('places', {
                        type: 'geojson',
                        data: geojson
                    });

                    // Add a layer showing the places with custom icons
                    map.addLayer({
                        'id': 'places',
                        'type': 'symbol',
                        'source': 'places',
                        'layout': {
                            'icon-image': 'aws',
                            'icon-size': 0.025, // Adjust as needed
                            'icon-allow-overlap': true // Allow icons to overlap
                        }
                    });

                    // Create a popup
                    const popup = new maplibregl.Popup({
                        closeButton: false,
                        closeOnClick: false
                    });

                    // Event handlers for mouse enter and leave
                    map.on('mouseenter', 'places', (e) => {
                        map.getCanvas().style.cursor = 'pointer';
                        const coordinates = e.features[0].geometry.coordinates.slice();
                        const name = e.features[0].properties.name;

                        // Set popup content and position
                        popup.setLngLat(coordinates).setHTML(name).addTo(map);
                    });

                    map.on('mouseleave', 'places', () => {
                        map.getCanvas().style.cursor = '';
                        popup.remove();
                    });
                } catch (error) {
                    console.error('Error loading image:', error);
                }
            });

            // Helper function to load the image
            async function loadImage(url) {
                return new Promise((resolve, reject) => {
                    const img = new Image();
                    img.crossOrigin = 'anonymous'; // Enable CORS
                    img.onload = () => resolve(img);
                    img.onerror = (error) => reject(error);
                    img.src = url;
                });
            }
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body { margin: 0; padding: 0; } 
html, body, #map { height: 100%; }
```

------

# How to set a preferred language for a map
<a name="how-to-set-preferred-language-map"></a>

Amazon Location Service enables you to set the preferred language at the client-side by updating the style descriptor for a specific language. You can set a preferred language and display content in that language where embedded. Otherwise, it will fall back to another language.

**Note**  
For more information, see [Localization and internationalization](maps-localization-internationalization.md).

## Set preferred language to Japanese and show map of Japan
<a name="set-preferred-language-japanese"></a>

In this example, you will set update style to show map labels in Japanese (ja).

### Set preferred language to Japanese example
<a name="set-preferred-language-japanese-example"></a>

------
#### [ index.html ]

```
<html>
<head>
    <link href="https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css" rel="stylesheet" />
    <script src="https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js"></script>
    <link href="style.css" rel="stylesheet" />
    <script src="main.js"></script>
</head>
<body>
    <div id="map" />
    <script>
        const apiKey = "Add Your Api Key";
        const mapStyle = "Standard";
        const awsRegion = "eu-central-1";
        const initialLocation = [139.76694, 35.68085]; //Japan   
        
        async function initializeMap() {
            // get updated style object for preferred language. 
            const styleObject = await getStyleWithPreferredLanguage("ja");
            // Initialize the MapLibre map with the fetched style object
            const map = new maplibregl.Map({
                container: 'map',
                style: styleObject,
                center: initialLocation,
                zoom: 15,
                hash:true,
            });
            map.addControl(new maplibregl.NavigationControl(), "top-left");
        
            return map; 
        }
  
        initializeMap();
    </script>
</body>
</html>
```

------
#### [ style.css ]

```
body { margin: 0; }
#map { height: 100vh; }
```

------
#### [ main.js ]

```
async function getStyleWithPreferredLanguage(preferredLanguage) {
    const styleUrl = `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?key=${apiKey}`;

    return fetch(styleUrl)
        .then(response => {
            if (!response.ok) {
                throw new Error('Network response was not ok ' + response.statusText);
            }
            return response.json();
        })
        .then(styleObject => {
            if (preferredLanguage !== "en") {
                styleObject = setPreferredLanguage(styleObject, preferredLanguage);
            }

            return styleObject;
        })
        .catch(error => {
            console.error('Error fetching style:', error);
        });
}

const setPreferredLanguage = (style, language) => {
    let nextStyle = { ...style };

    nextStyle.layers = nextStyle.layers.map(l => {
        if (l.type !== 'symbol' || !l?.layout?.['text-field']) return l;
        return updateLayer(l, /^name:([A-Za-z\-\_]+)$/g, `name:${language}`);
    });

    return nextStyle;
};

const updateLayer = (layer, prevPropertyRegex, nextProperty) => {
    const nextLayer = {
        ...layer,
        layout: {
            ...layer.layout,
            'text-field': recurseExpression(
                layer.layout['text-field'],
                prevPropertyRegex,
                nextProperty
            )
        }
    };
    return nextLayer;
};

const recurseExpression = (exp, prevPropertyRegex, nextProperty) => {
    if (!Array.isArray(exp)) return exp;
    if (exp[0] !== 'coalesce') return exp.map(v =>
        recurseExpression(v, prevPropertyRegex, nextProperty)
    );

    const first = exp[1];
    const second = exp[2];

    let isMatch =
    Array.isArray(first) &&
    first[0] === 'get' &&
    !!first[1].match(prevPropertyRegex)?.[0];

    isMatch = isMatch && Array.isArray(second) && second[0] === 'get';
    isMatch = isMatch && !exp?.[4];

    if (!isMatch) return exp.map(v =>
        recurseExpression(v, prevPropertyRegex, nextProperty)
    );

    return [
        'coalesce',
        ['get', nextProperty],
        ['get', 'name:en'],
        ['get', 'name']
    ];
};
```

------

## Set preferred language based on end user's browser language
<a name="set-preferred-language-browser"></a>

In this example, you will set update style to show map labels in user's device language. 

### Set preferred language based on browser language example
<a name="set-preferred-language-browser-code"></a>

------
#### [ index.html ]

```
<html>
<head>
    <link href="https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css" rel="stylesheet" />
    <script src="https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js"></script>
    <link href="style.css" rel="stylesheet" />
    <script src="main.js"></script>
</head>
<body>
    <div id="map" />
    <script>
        const apiKey = "Add Your Api Key";
        const mapStyle = "Standard";
        const awsRegion = "eu-central-1";
        const initialLocation = [139.76694, 35.68085]; //Japan     
        const userLanguage = navigator.language || navigator.userLanguage;
        const languageCode = userLanguage.split('-')[0];

        async function initializeMap() {
             const styleObject = await getStyleWithPreferredLanguage(languageCode);
             const map = new maplibregl.Map({
                 container: 'map',
                 style: styleObject,
                 center: initialLocation,
                 zoom: 15,
                 hash:true,
             });
             map.addControl(new maplibregl.NavigationControl(), "top-left");
             return map; 
        }

        initializeMap();
    </script>
</body>
</html>
```

------
#### [ style.css ]

```
body { margin: 0; }
#map { height: 100vh; }
```

------
#### [ main.js ]

```
async function getStyleWithPreferredLanguage(preferredLanguage) {
    const styleUrl = `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?key=${apiKey}`;

    return fetch(styleUrl)
        .then(response => {
            if (!response.ok) {
                throw new Error('Network response was not ok ' + response.statusText);
            }
            return response.json();
        })
        .then(styleObject => {
            if (preferredLanguage !== "en") {
                styleObject = setPreferredLanguage(styleObject, preferredLanguage);
            }

            return styleObject;
        })
        .catch(error => {
            console.error('Error fetching style:', error);
        });
}

const setPreferredLanguage = (style, language) => {
    let nextStyle = { ...style };

    nextStyle.layers = nextStyle.layers.map(l => {
        if (l.type !== 'symbol' || !l?.layout?.['text-field']) return l;
        return updateLayer(l, /^name:([A-Za-z\-\_]+)$/g, `name:${language}`);
    });

    return nextStyle;
};

const updateLayer = (layer, prevPropertyRegex, nextProperty) => {
    const nextLayer = {
        ...layer,
        layout: {
            ...layer.layout,
            'text-field': recurseExpression(
                layer.layout['text-field'],
                prevPropertyRegex,
                nextProperty
            )
        }
    };
    return nextLayer;
};

const recurseExpression = (exp, prevPropertyRegex, nextProperty) => {
    if (!Array.isArray(exp)) return exp;
    if (exp[0] !== 'coalesce') return exp.map(v =>
        recurseExpression(v, prevPropertyRegex, nextProperty)
    );

    const first = exp[1];
    const second = exp[2];

    let isMatch =
    Array.isArray(first) &&
    first[0] === 'get' &&
    !!first[1].match(prevPropertyRegex)?.[0];

    isMatch = isMatch && Array.isArray(second) && second[0] === 'get';
    isMatch = isMatch && !exp?.[4];

    if (!isMatch) return exp.map(v =>
        recurseExpression(v, prevPropertyRegex, nextProperty)
    );

    return [
        'coalesce',
        ['get', nextProperty],
        ['get', 'name:en'],
        ['get', 'name']
    ];
};
```

------

# How to set the political view of a map
<a name="how-to-set-political-view-map"></a>

Amazon Location Service enables you to set the political view to ensure your application complies with local laws. You can set a political view and compare maps from different political perspectives.

**Note**  
For more information, see [Localization and internationalization](maps-localization-internationalization.md).

## Set political view and compare with international perspective
<a name="set-political-view"></a>

In this example, you will create and compare maps from two different political views: an international perspective and Turkey's view on Cyprus.

### Political view comparison example
<a name="set-political-view-compare-code"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Display a map</title>
        <meta property="og:description" content="Initialize a map in an HTML element with MapLibre GL JS." />
        <meta charset='utf-8'>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
        <link rel='stylesheet' href='style.css' />
        <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
        <script src="https://unpkg.com/@mapbox/mapbox-gl-sync-move@0.3.1"></script>
        <script src='main.js'></script>
    </head>
    <body>
        <!-- Map container -->
        <div class="maps">
        <div id="internationalView"></div>
        <div id="turkeyView"></div>
        </div>
        <script>

            const apiKey = "Add Your Api Key";
            const mapStyle = "Standard";
            const awsRegion = "eu-central-1";

            // International perspective without political-view query parameter
            const internationalViewMapStyleUrl = `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?key=${apiKey}`;

            // Turkey perspective with political-view query parameter
            const turkeyViewMapStyleUrl = `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?political-view=TUR&key=${apiKey}`;

            const internationalViewMap = new maplibregl.Map({
                container: 'internationalView', // container id
                style: internationalViewMapStyleUrl, // style URL
                center: [33.0714561, 35.1052139], // starting position [lng, lat]
                zoom: 7.5,
                validateStyle: false, // Disable style validation for faster map load
            });

            const turkeyViewMap = new maplibregl.Map({
                container: 'turkeyView', // container id
                style: turkeyViewMapStyleUrl, // style URL
                center: [33.0714561, 35.1052139],
                zoom: 7.5,
                validateStyle: false, // Disable style validation for faster map load
            });

            // Sync map zoom and center
            syncMaps(internationalViewMap, turkeyViewMap);

            // Informational popup for international view
            new maplibregl.Popup({closeOnClick: false})
                .setLngLat([33, 35.5])
                .setHTML('<h4>International view <br> recognizes <br> Cyprus</h4>')
                .addTo(internationalViewMap);

            // Informational popup for Turkey's view
            new maplibregl.Popup({closeOnClick: false})
                .setLngLat([33, 35.5])
                .setHTML('<h4>Turkey does not <br> recognize <br> Cyprus</h4>')
                .addTo(turkeyViewMap);
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body { margin: 0; padding: 0; }
html, body { height: 100%; }
#internationalView, #turkeyView { height: 100%; width: 100%; }
.maps {
    display: flex;
    width: 100%;
    height: 100%;
}
```

------

# How to filter POI on the map
<a name="how-to-filter-poi-map"></a>

Amazon Location Service allows you to select the POI (point-of-interest) categories relevant to your use case. Learn more about the standard map style, [Rich POI](https://docs.aws.amazon.com/location/latest/developerguide/standard-map-style.html#rich-poi) 

## Filter POI
<a name="test-collapse-me"></a>

In this example, you display an interactive map that allows users to filter on POI categories.

------
#### [ Index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>POI demo</title>
        <meta property="og:description" content="" />
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <link rel="stylesheet" href="https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css" />
        <link rel='stylesheet' href='style.css' />
        <script src="https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js"></script>

    </head>
    <body>

        <div id="map"></div>
        <ul id="buttons"></ul>
        <script>
            // -------------------------------------------------------------------------------------------
            // Function to set layer state
            // -------------------------------------------------------------------------------------------

            const initialLayerState = {
                Buildings: {
                    layers: ['poi_900_areas_buildings'],
                    visibility: 'visible'
                },
                'Business & Services': {
                    layers: ['poi_700_business_services'],
                    visibility: 'visible'
                },
                Shopping: { layers: ['poi_600_shopping'], visibility: 'visible' },
                'Leisure & Outdoors': {
                    layers: ['poi_550_leisure_outdoor'],
                    visibility: 'visible'
                },
                Facilities: { layers: ['poi_800_facilities'], visibility: 'visible' },
                Transit: { layers: ['poi_400_transit'], visibility: 'visible' },
                'Sights & Museums': {
                    layers: ['poi_300_sights_museums'],
                    visibility: 'visible'
                },
                'Food & Drink': {
                    layers: ['poi_100_food_drink'],
                    visibility: 'visible'
                },
                'Going Out & Entertainment': {
                    layers: ['poi_200_going_out_entertainment'],
                    visibility: 'visible'
                },
                Accommodations: {
                    layers: ['poi_500_accommodations'],
                    visibility: 'visible'
                },
                Parks: { layers: ['poi_landuse_park'], visibility: 'visible' },
                'Public Complexes': {
                    layers: ['poi_landuse_public_complex'],
                    visibility: 'visible'
                }
            };

            // -------------------------------------------------------------------------------------------
            // Setup auth and state
            // -------------------------------------------------------------------------------------------

            let state = { ...initialLayerState };

                const API_KEY = "<api key>"; // check how to create api key for Amazon Location
                const AWS_REGION = "eu-central-1"; // Replace with your AWS region

                const mapStyle = "Standard";
                const colorScheme = "Light";


            // Style URL
            const styleUrl = `https://maps.geo.${AWS_REGION}.amazonaws.com/v2/styles/${mapStyle}/descriptor?key=${API_KEY}&color-scheme=${colorScheme}`;


            // Render the map with the stylesheet
            map = new maplibregl.Map({
                container: 'map',
                style: styleUrl,
                center: [-73.966148, 40.781803],
                zoom: 17
            });

            const buttonContainer = document.getElementById('buttons');

            for (const category of Object.keys(state)) {
                const newButton = document.createElement('li');
                newButton.classList.add('button');
                newButton.classList.add('active');
                newButton.id = category;

                // Each config has a label
                newButton.textContent = category;

                // On click, we want to switch the value between 'on' and 'off'
                // We could check the config for available options in more complex cases
                newButton.onclick = () => {
                    onClickCategory(category);
                };

                // Append the button to our button container
                buttonContainer.appendChild(newButton);
            }

            // -------------------------------------------------------------------------------------------
            // LAYER VISIBILITY FUNCTION
            // -------------------------------------------------------------------------------------------

            // On click, get the stylesheet, update the language, and set the style
            const onClickCategory = category => {
                const categoryState = state[category];
                const { visibility, layers } = categoryState;

                let nextState;

                // For active button styling
                const activeButton = document.getElementById(category);

                if (visibility === 'visible') {
                    nextState = 'none';
                    activeButton.classList.remove('active');
                } else {
                    nextState = 'visible';
                    activeButton.classList.add('active');
                }

                layers.forEach(id =>
                    map.setLayoutProperty(id, 'visibility', nextState)
                );

                state[category].visibility = nextState;
            };
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body {
    margin: 0;
    padding: 0;
}
html,
body,
#map {
    height: 100%;
}


#buttons {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: absolute;
    top: 0;
    min-width: 100px;
    max-height: calc(100% - 2rem);
    overflow: auto;
    padding: 1rem;
    background-color: white;
    margin: 0;
}

.button {
    display: inline-block;
    cursor: pointer;
    padding: 8px;
    border-radius: 3px;
    margin-top: 10px;
    font-size: 12px;
    text-align: center;
    color: #fff;
    background: #8a8a8a;
    font-family: sans-serif;
    font-weight: bold;
}

.button:first-child {
    margin-top: 0;
}

.active {
    background: #ee8a65;
}
```

------

# How to create topographic maps
<a name="how-to-create-topographic-maps"></a>

Amazon Location Service allows you to create topographic maps using Terrain and Contour density features to visualize elevation changes and geographic characteristics.

## Show Hillshade
<a name="show-hillshade"></a>

The Terrain feature allows you to visualize Hillshade, elevation changes and related geographic features.

### Hillshade example
<a name="hillshade-example"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Terrain Map</title>
        <meta charset='utf-8'>
            <meta name="viewport" content="width=device-width, initial-scale=1">
                <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
                <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
    </head>
    <body style="margin: 0; padding: 0;">
        <div id="map" style="width: 100%; height: 100vh;"></div>
        <script>
            const apiKey = "Add Your Api Key";
            const mapStyle = "Standard";
            const awsRegion = "us-east-1";

            const map = new maplibregl.Map({
                container: 'map',
                style: `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?terrain=Hillshade&key=${apiKey}`,
                center: [-119.5383, 37.8651], // Yosemite coordinates for terrain visibility
                zoom: 12,
                validateStyle: false, // Disable style validation for faster map load
            });
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
```

------

## Show elevation with Contour Density lines
<a name="show-contour-density"></a>

Amazon Location Service allows you to add Contour Density features to your map. This provides visualization of geographic steepness and elevation changes.

### Contour Density example
<a name="contour-density-example"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Contour Map</title>
        <meta charset='utf-8'>
            <meta name="viewport" content="width=device-width, initial-scale=1">
                <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
                <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
    </head>
    <body style="margin: 0; padding: 0;">
        <div id="map" style="width: 100%; height: 100vh;"></div>
        <script>
            const apiKey = "Add Your Api Key";
            const mapStyle = "Standard";
            const awsRegion = "us-east-1";

            const map = new maplibregl.Map({
                container: 'map',
                style: `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?contour-density=Medium&key=${apiKey}`,
                center: [-119.3047, 37.7887], 
                zoom: 12,
                validateStyle: false, // Disable style validation for faster map load
            });
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
```

------

## Show both Hillshade and Contour Density lines
<a name="show-hillshade-contour"></a>

With Amazon Location Service you to combine both Hillshade and Contour Density features on your map for comprehensive terrain visualization. This provides enhanced depth perception and a complete understanding of topographical variations and terrain characteristics.

### Hillshade with Contour Density example
<a name="hillshade-contour-example"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Hillshade and Contour Map</title>
        <meta charset='utf-8'>
            <meta name="viewport" content="width=device-width, initial-scale=1">
                <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
                <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
    </head>
    <body style="margin: 0; padding: 0;">
        <div id="map" style="width: 100%; height: 100vh;"></div>
        <script>
            const apiKey = "Add Your Api Key";
            const mapStyle = "Standard";
            const awsRegion = "us-east-1";

            const map = new maplibregl.Map({
                container: 'map',
                style: `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?contour-density=Medium&terrain=Hillshade&key=${apiKey}`,
                center: [-119.3047, 37.7887],
                zoom: 12,
                validateStyle: false, // Disable style validation for faster map load
            });
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
```

------

# How to show real-time traffic on a map
<a name="how-to-set-real-time-traffic-map"></a>

 Using Amazon Location Service you can add traffic features to your map. This provides real-time traffic data to show current traffic conditions such as current road congestion, construction, and incidents, helping you make routing choices.

## Make a map with real-time traffic
<a name="how-to-set-real-time-traffic"></a>

This example shows how to create a map with real-time traffic data.

### Real-time Traffic example
<a name="how-to-set-real-time-traffic-code"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Traffic Map</title>
        <meta charset='utf-8'>
            <meta name="viewport" content="width=device-width, initial-scale=1">
                <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
                <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
    </head>
    <body style="margin: 0; padding: 0;">
        <div id="map" style="width: 100%; height: 100vh;"></div>
        <script>
            const apiKey = "Add Your Api Key";
            const mapStyle = "Standard";
            const awsRegion = "us-east-1";

            const map = new maplibregl.Map({
                container: 'map',
                style: `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?traffic=All&key=${apiKey}`,
                center: [-74.0060 ,40.7128], // New York City coordinates for traffic visibility
                zoom: 12,
                validateStyle: false, // Disable style validation for faster map load
            });
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body {
    margin: 0;
    padding: 0;
}

#map {
    width: 100%;
    height: 100vh;
}
```

------

# How to create a logistics map
<a name="how-to-create-logistic-map"></a>

The TravelModes feature lets you build logistic maps using Amazon Location Service. TravelModes displays relevant routing information for Truck navigation with related road restrictions. Use [Transit TravelMode](https://docs.aws.amazon.com/location/latest/developerguide/how-to-show-transit-details-map.html) to show public transportation details.

## Create a map with Truck TravelMode
<a name="how-to-create-truck-map"></a>

This example shows how to create a map with `Truck` `TravelMode` for logistic routing.

### Truck example
<a name="how-to-create-truck-map-code"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Truck Map</title>
        <meta charset='utf-8'>
            <meta name="viewport" content="width=device-width, initial-scale=1">
                <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
                <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
    </head>
    <body style="margin: 0; padding: 0;">
        <div id="map" style="width: 100%; height: 100vh;"></div>
        <script>
            const apiKey = "Add Your Api Key";
            const mapStyle = "Standard";
            const awsRegion = "us-east-1";

            const map = new maplibregl.Map({
                container: 'map',
                style: `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?travel-modes=Truck&key=${apiKey}`,
                center: [-74.0060 ,40.7128],
                zoom: 12,
                validateStyle: false, // Disable style validation for faster map load
            });
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body {
    margin: 0;
    padding: 0;
}

#map {
    width: 100%;
    height: 100vh;
}
```

------

# How to show transit details on a map
<a name="how-to-show-transit-details-map"></a>

Amazon Location Service lets you add transit features to maps. The `Transit` `TravelMode` displays routing information for public transit, such as color-coded train lines. Also check how to set [logistics TravelMode](https://docs.aws.amazon.com/location/latest/developerguide/how-to-create-logistic-map.html) for additional options.

## Create a map with transit details
<a name="how-to-show-transit-map"></a>

This example shows how to create a map with transit details with Transit TravelMode for public transportation.

### Transit example
<a name="how-to-show-transit-map-code"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Transit Map</title>
        <meta charset='utf-8'>
            <meta name="viewport" content="width=device-width, initial-scale=1">
                <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
                <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
    </head>
    <body style="margin: 0; padding: 0;">
        <div id="map" style="width: 100%; height: 100vh;"></div>
        <script>
            const apiKey = "Add Your Api Key";
            const mapStyle = "Standard";
            const awsRegion = "us-east-1";

            const map = new maplibregl.Map({
                container: 'map',
                style: `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?travel-modes=Transit&key=${apiKey}`,
                center: [-74.0060 ,40.7128],
                zoom: 12,
                validateStyle: false, // Disable style validation for faster map load
            });
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body {
    margin: 0;
    padding: 0;
}

#map {
    width: 100%;
    height: 100vh;
}
```

------

# How to create a 3D map
<a name="how-to-create-a-3d-map"></a>

Amazon Location Service lets you add three-dimensional features to maps, such as `Terrain3D` to display elevation data as a three-dimensional surface, or `Buildings3D` to display urban structures with height and volume. 

## Create a map with three-dimensional terrain details
<a name="how-to-show-3d-terrain-map"></a>

This example shows how to create a map with `Terrain3D` parameter. 

### Terrain3D example
<a name="how-to-show-3d-terrain-map-code"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>3D Terrain</title>
        <meta charset='utf-8'>
            <meta name="viewport" content="width=device-width, initial-scale=1">
                <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
                <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
    </head>
    <body style="margin: 0; padding: 0;">
        <div id="map" style="width: 100%; height: 100vh;"></div>
        <script>
            const apiKey = "Add Your Api Key";
            const mapStyle = "Standard";
            const awsRegion = "us-east-1";

            const map = new maplibregl.Map({
                container: 'map',
                style: `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?terrain=Terrain3D&key=${apiKey}`,
                center: [7.6583, 45.9763],
                zoom: 12,
                pitch: 60, // Tilt angle (0-85 degrees)
                validateStyle: false, // Disable style validation for faster map load
            });
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body {
    margin: 0;
    padding: 0;
}

#map {
    width: 100%;
    height: 100vh;
}
```

------

## Create a map with three-dimensional buildings details
<a name="how-to-show-3d-buildings-map"></a>

This example shows how to create a map with `Buildings3D` parameter. 

### Buildings3D example
<a name="how-to-show-3d-buildings-map-code"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>3D Buildings</title>
        <meta charset='utf-8'>
            <meta name="viewport" content="width=device-width, initial-scale=1">
                <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
                <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
    </head>
    <body style="margin: 0; padding: 0;">
        <div id="map" style="width: 100%; height: 100vh;"></div>
        <script>
            const apiKey = "Add Your Api Key";
            const mapStyle = "Standard";
            const awsRegion = "us-east-1";

            const map = new maplibregl.Map({
                container: 'map',
                style:
                `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?buildings=Buildings3D&key=${apiKey}`,
                center: [7.6583, 45.9763],
                zoom: 12,
                pitch: 60, // Tilt angle (0-85 degrees)
                validateStyle: false, // Disable style validation for faster map load
            });
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body {
    margin: 0;
    padding: 0;
}

#map {
    width: 100%;
    height: 100vh;
}
```

------

## Enable/disable Globe view
<a name="how-to-enable-disable-globe-view"></a>

This example shows how to enable or disable the Globe view projection. By default, Globe view is enabled. 

### Globe view example
<a name="how-to-enable-disable-globe-view-code"></a>

------
#### [ index.html ]

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Globe View</title>
        <meta charset='utf-8'>
            <meta name="viewport" content="width=device-width, initial-scale=1">
                <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
                <script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
    </head>
    <body style="margin: 0; padding: 0;">
        <div id="map" style="width: 100%; height: 100vh;"></div>
        <script>
            const apiKey = "Add Your Api Key";
            const mapStyle = "Standard";
            const awsRegion = "us-east-1";

            const map = new maplibregl.Map({
                container: 'map',
                style:
                `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?key=${apiKey}`,
                center: [-74.5, 40],
                zoom: 2,
                validateStyle: false, // Disable style validation for faster map load
            });

            map.on('style.load', () => {
                // Globe view is enabled by default
                // To disable globe view, uncomment the next line:
                // map.setProjection({});
            });
        </script>
    </body>
</html>
```

------
#### [ style.css ]

```
body {
    margin: 0;
    padding: 0;
}

#map {
    width: 100%;
    height: 100vh;
}
```

------

# How to use static maps
<a name="static-maps-how-to"></a>

These how-to topics offer step-by-step guidance for customizing static maps with overlays and visual elements, utilizing the mapping capabilities of Amazon Location Service. Each guide walks you through key tasks, such as adjusting map dimensions, choosing between zoom or radius, and adding various geo-spatial elements like markers, polygons, lines, and proximity circles. These guides use both compact and GeoJSON formats to ensure flexibility in styling and configuration.

Whether you're optimizing maps for customer-facing applications or performing geospatial analysis, these topics provide clear instructions on tailoring your static maps to fit specific requirements. By following the detailed examples, you’ll learn how to enhance map presentations and efficiently manage geographical data for a variety of business needs.

**Topics**
+ [

# How to get a static map of a specific position
](get-static-map-specific-position.md)
+ [

# How to get a static map of a specific dimension
](get-static-map-specific-dimension.md)
+ [

# How to decide between radius and zoom for a static map
](choose-radius-vs-zoom.md)
+ [

# How to add scale for a static map
](add-scale-static-map.md)
+ [

# How to add a marker to a static map
](add-marker-static-map.md)
+ [

# How to add a line to a static map
](how-to-add-line-static.md)
+ [

# How to add a route to a static map
](how-to-add-route.md)
+ [

# How to add a polygon to a static map
](how-to-add-polygon-static.md)
+ [

# How to set language for static maps
](set-language-static-map.md)
+ [

# How to add a proximity circle to a static map
](how-to-add-proximity-circle.md)

# How to get a static map of a specific position
<a name="get-static-map-specific-position"></a>

In this topic, you will learn how to retrieve static maps from Amazon Location Service based on specific parameters. You will learn how to generate a static map for a center position, a bounding box, and a set of bounded positions. The examples provided will help you customize the width, height, and style of the map.

**Note**  
You must pass either `map` or `map@2x` when generating a static map.

## Get map image for a center position
<a name="get-map-center-position"></a>

In this example, you will create a map image with a width of `1024` and a height of `1024` with the center coordinates set at `-123.1143,49.2763`, where `longitude=-123.1143` and `latitude=49.2763`, and a zoom level of `15`.

------
#### [ Request URL ]

```
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map?style=Satellite&width=1024&height=1024&zoom=15&center=-123.1156126,49.2767046&key=API_KEY
```

------
#### [ Response image ]

![\[Aerial view of a coastal city with dense urban layout, harbor, and large stadium visible.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/static-center.png)


------

## Get map image for bounding box
<a name="get-map-bounding-box"></a>

In this example, you'll generate a map image of Southeast Asia by setting the bounding box for the area. 

The `bbox` format is `{southwest_longitude},{southwest_latitude},{northeast_longitude},{northeast_latitude}`.

------
#### [ Request URL ]

```
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map?style=Satellite&width=1024&height=1024&bounding-box=90.00,-21.94,146.25,31.95&key=API_KEY
```

------
#### [ Response image ]

![\[Satellite view of Southeast Asia, showing mainland, islands, and surrounding waters.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/static-bounding-box.png)


------

## Get map image for bounded positions
<a name="get-map-bounded-positions"></a>

In this example, you will generate a map that covers several must-see places in Paris, each specified by its coordinates (longitude, latitude). The bounded positions include: Eiffel Tower, Louvre Museum, Notre-Dame Cathedral, Champs-Élysées, Arc de Triomphe, Sacré-Cœur Basilica, Luxembourg Gardens, Musée d'Orsay, Place de la Concorde, and Palais Garnier. 

The format for bounding positions is `{longitude1},{latitude1},{longitude2},{latitude2} ... {longitudeN},{latitudeN}`.

------
#### [ Request URL ]

```
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map?style=Satellite&width=1024&height=1024&bounded-positions=2.2945,48.8584,2.3376,48.8606,2.3500,48.8529,2.3076,48.8698,2.2950,48.8738,2.3431,48.8867,2.3372,48.8462,2.3266,48.8600,2.3212,48.8656,2.3317,48.8719&key=API_KEY
```

------
#### [ Response image ]

![\[Aerial view of Paris showing dense urban layout, Seine River, and iconic landmarks.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/static-bounding-position.png)


------

# How to get a static map of a specific dimension
<a name="get-static-map-specific-dimension"></a>

In this topic, you will learn how to set the dimensions (height and width) for static maps using Amazon Location Service. Customizing the dimensions of a map image allows you to balance performance, visual quality, and usability. The maximum values for both `width` and `height` are 1400 pixels, while the minimum values are 64 pixels. The maximum result size is 6 MB.

Additionally, you can use the `bbox` and `bounds` parameters along with `padding` to ensure that important map features near the edges are fully visible and not cut off.

## Get map image with specific height and width
<a name="get-map-specific-dimension"></a>

In this example, you will create a low-resolution and mid-resolution map image of Helsinki, Finland.

------
#### [ Request URL for low-resolution thumbnail ]

```
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map?style=Satellite&width=200&height=200&zoom=11.5&center=24.9460,60.1690&key=API_KEY
```

------
#### [ Response (Thumbnail 200x200) ]

![\[Aerial view of a coastal city with intricate waterways, islands, and urban development.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/static-specific-dimension-low.png)


------
#### [ Request URL for mid-resolution image ]

```
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map?style=Satellite&width=700&height=700&zoom=13&center=24.9460,60.1690&key=API_KEY
```

------
#### [ Response image (700x700) ]

![\[Aerial view of a coastal city with dense urban development, harbors, and surrounding waters.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/static-specific-dimension-mid.png)


------

## Get map image with padding on all sides
<a name="get-map-with-padding"></a>

In this example, you will generate a map using several must-see places in Helsinki, Finland, with their coordinates (longitude, latitude), both with and without padding.

------
#### [ Request URL with padding ]

```
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map?style=Satellite&width=1024&height=1024&padding=150&bounded-positions=24.9526,60.1692,24.9850,60.1465,24.9270,60.1725,24.9226,60.1826,24.9509,60.1675,24.9566,60.1685,24.9457,60.1674,24.9397,60.1719,24.9414,60.1715,24.9387,60.1720&key=API_KEY
```

------
#### [ Response image (with padding) ]

![\[Aerial view of a coastal city with dense urban areas, harbors, and surrounding islands.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/static-specific-dimension-padding.png)


------
#### [ Request URL without padding ]

```
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map?style=Satellite&width=1024&height=1024&bounded-positions=24.9526,60.1692,24.9850,60.1465,24.9270,60.1725,24.9226,60.1826,24.9509,60.1675,24.9566,60.1685,24.9457,60.1674,24.9397,60.1719,24.9414,60.1715,24.9387,60.1720&key=API_KEY
```

------
#### [ Response image (without padding) ]

![\[Aerial view of a coastal city with dense urban areas, harbors, and small islands.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/static-specific-dimension-no-padding.png)


------

# How to decide between radius and zoom for a static map
<a name="choose-radius-vs-zoom"></a>

In this topic, you will learn how to choose between using `radius` or `zoom` when generating static maps with Amazon Location Service. The `radius` parameter provides more precise control over the area of coverage, making it ideal for customer-facing applications where you know the exact coverage area. The `zoom` parameter is better suited for geospatial analysis when you want to adjust the level of detail displayed.

## With radius
<a name="with-radius"></a>

In this example, you will create a map image of Sri Lanka using the `radius` parameter with a center location.

------
#### [ Request URL ]

```
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map?style=Satellite&width=700&height=700&center=80.60596,7.76671&radius=235000&scale-unit=KilometersMiles&key=API_KEY
```

------
#### [ Response image ]

![\[Satellite view of Sri Lanka, showing the teardrop-shaped island nation surrounded by ocean.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/static-radius.png)


------

## With zoom
<a name="with-zoom"></a>

In this example, you will create a map image of Sri Lanka using the `zoom` parameter with a center location.

------
#### [ Request URL ]

```
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map?style=Satellite&width=700&height=700&zoom=8&center=80.60596,7.76671&scale-unit=KilometersMiles&key=API_KEY
```

------
#### [ Response image ]

![\[Satellite view of Sri Lanka, showing the teardrop-shaped island nation surrounded by ocean.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/static-zoom.png)


------

# How to add scale for a static map
<a name="add-scale-static-map"></a>

In this topic, you will learn how to display a scale on the bottom-right corner of a static map generated with Amazon Location Service. The scale can show a single unit, such as `Miles` or `Kilometers`, or both units, such as `KilometersMiles` or `MilesKilometers`, with one unit displayed at the top and the other at the bottom.

## Add scale with single unit
<a name="add-scale-single-unit"></a>

In this example, you will display a map of Helsinki, Finland with the scale set to `Kilometers` in the bottom-right corner.

------
#### [ Request URL ]

```
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map?style=Satellite&width=1024&height=1024&zoom=13.5&center=24.9189564,60.1645772&scale-unit=Kilometers&key=API_KEY
```

------
#### [ Response image ]

![\[Aerial view of a coastal city with dense urban areas, waterways, and islands.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/static-scale-single.png)


------

## Add scale with both units
<a name="add-scale-both-units"></a>

In this example, you will display a map of Helsinki, Finland with both `Kilometers` and `Miles` shown on the scale in the bottom-right corner, with one unit displayed above the other.

------
#### [ Request URL ]

```
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map?style=Satellite&width=1024&height=1024&zoom=14&center=24.9189564,60.1645772&scale-unit=KilometersMiles&key=API_KEY
```

------
#### [ Response image ]

![\[Aerial view of a coastal city with dense urban areas, harbors, and islands surrounded by water.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/static-scale-both.png)


------

# How to add a marker to a static map
<a name="add-marker-static-map"></a>

In this topic, you will learn how to add markers to static maps generated with Amazon Location Service. You can customize the marker's icon, label, size, color, and other styling options. This allows you to highlight specific locations with visual cues that align with your map's purpose.

## Marker styling
<a name="marker-styling"></a>


| Name | Type | Default | Description | 
| --- | --- | --- | --- | 
| `style` | String | `marker` | The style of the Point geometry. To create a marker, set the value to `marker` or do not include the `style` attribute in the properties object of the GeoJSON. | 
| `icon` | String | `pin` | The marker icon type. Available values include: `cp` (proximity circle), `diamond`, `pin`, `poi`, `square`, `triangle`, `bubble`. | 
| `label` | String | `<empty>` | The text to display at the coordinates. To set automatic labels, use the following values: `$alpha` (Latin alphabet) or `$num` (Arabic numerals). | 
| `color` | Color | Style-dependent | The icon color. | 
| `outline-color` | Color | Style-dependent | The icon outline color. | 
| `text-color` | Color | Style-dependent | The label text color. | 
| `text-outline-color` | Color | Style-dependent | The text outline color. | 
| `outline-width` | Integer | `0` (turned off) | The text outline width. | 
| `size` | String | `medium` | The label and icon size. Available values: `small`, `medium`, `large`. | 

## Add a Marker to a Map Image
<a name="add-marker-single"></a>

In this example, you will place a marker with a label on the map image of BC Place, Vancouver.

`Geo JSON`:

```
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          -123.11210,
          49.2767875
        ]
        },
      "properties": {
          "color":"#EE4B2B",
          "size":"large",
          "label":"BC Place, Vancouver",
          "text-color":"#0000FF"
       }
    }
  ]
}
```

`Compact`:

```
point: -123.11210,49.27678;
label=BC Place, Vancouver;
size=large;
text-color=#0000FF;
color=#EE4B2B
```

------
#### [ Request URL ]

With the GeoJSON overlay

```
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map?style=Satellite&width=1024&height=1024&zoom=15&scale-unit=KilometersMiles&geojson-overlay=%7B%22type%22%3A%22FeatureCollection%22,%22features%22%3A%5B%7B%22type%22%3A%22Feature%22,%22properties%22%3A%7B%22color%22%3A%22%23EE4B2B%22,%22size%22%3A%22large%22,%22label%22%3A%22BC%20Place,%20Vancouver%22,%22text-color%22%3A%22%230000FF%22%7D,%22geometry%22%3A%7B%22coordinates%22%3A%5B-123.11210974152168,49.27678753813112%5D,%22type%22%3A%22Point%22%7D%7D%5D%7D&key=API_KEY
```

------
#### [ Response image ]

![\[Aerial view of Vancouver's downtown and harbor, with BC Place stadium marked.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/static-add-marker.png)


------

## Add multiple markers to a map image
<a name="add-multiple-markers"></a>

In this example, you will add markers for must-see places in Helsinki, Finland using their coordinates (longitude, latitude). You can also apply padding to ensure the map accommodates all markers properly.

**Note**  
The available marker icon type include: `cp` for proximity circle, `diamond, pin, poi, square, triangle, bubble`.

`Geo JSON`:

```
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "MultiPoint",
        "coordinates": [
          [24.9526, 60.1692],
          [24.9270, 60.1725],
          [24.9226, 60.1826],
          [24.9509, 60.1675],
          [24.9566, 60.1685],
          [24.9457, 60.1674],
          [24.9397, 60.1719],
          [24.9414, 60.1715],
          [24.9387, 60.1720]
        ]
      },
      "properties": {
        "icon":"diamond",
        "label":"$num",
        "size":"large",
        "text-color":"%23972E2B",
        "text-outline-color":"%23FFF",
        "text-outline-width":2
      }
    }
  ]
}
```

------
#### [ Request URL ]

```
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map?style=Satellite&width=1024&height=1024&padding=150&geojson-overlay=%7B%22type%22%3A%22FeatureCollection%22,%22features%22%3A%5B%7B%22type%22%3A%22Feature%22,%22geometry%22%3A%7B%22type%22%3A%22MultiPoint%22,%22coordinates%22%3A%5B%5B24.9526,60.1692%5D,%5B24.927,60.1725%5D,%5B24.9226,60.1826%5D,%5B24.9509,60.1675%5D,%5B24.9566,60.1685%5D,%5B24.9457,60.1674%5D,%5B24.9397,60.1719%5D,%5B24.9414,60.1715%5D,%5B24.9387,60.172%5D%5D%7D,%22properties%22%3A%7B%22icon%22%3A%22diamond%22,%22label%22%3A%22%24num%22,%22size%22%3A%22large%22,%22text-color%22%3A%22%23972E2B%22,%22text-outline-color%22%3A%22%23FFF%22,%22text-outline-width%22%3A2%7D%7D%5D%7D&key=API_KEY
```

------
#### [ Response image ]

![\[Aerial view of a city with lakes, buildings, roads, and numbered markers indicating points of interest.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/static-add-multi-markers.png)


------

## Change color of marker in a map image
<a name="change-marker-color"></a>

In this example, you will use bubble markers of different colors to represent cities across the world. You can customize the marker’s color, label, and other properties to suit the context of your map.

`Geo JSON`:

```
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [85.1376, 25.5941]
      },
      "properties": {
        "label": "Patna",
        "icon": "bubble",
        "color": "#FF5722",
        "outline-color": "#D74D3D",
        "text-color": "#FFFFFF"
      }
    },
    .....redacted.....
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [2.3522, 48.8566]
      },
      "properties": {
        "label": "Paris, France",
        "icon": "bubble",
        "color": "#FF9800",
        "outline-color": "#D76B0B",
        "text-color": "#FFFFFF"
      }
    }
  ]
}
```

------
#### [ Request URL ]

```
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map?style=Satellite&width=1400&height=1024&padding=150&geojson-overlay=%7B%22type%22%3A%22FeatureCollection%22,%22features%22%3A%5B%7B%22type%22%3A%22Feature%22,%22geometry%22%3A%7B%22type%22%3A%22Point%22,%22coordinates%22%3A%5B85.1376,25.5941%5D%7D,%22properties%22%3A%7B%22label%22%3A%22Patna%22,%22icon%22%3A%22bubble%22,%22color%22%3A%22%23FF5722%22,%22outline-color%22%3A%22%23D74D3D%22,%22text-color%22%3A%22%23FFFFFF%22%7D%7D,%7B%22type%22%3A%22Feature%22,%22geometry%22%3A%7B%22type%22%3A%22Point%22,%22coordinates%22%3A%5B105.8542,21.0285%5D%7D,%22properties%22%3A%7B%22label%22%3A%22Hanoi,%20Vietnam%22,%22icon%22%3A%22bubble%22,%22color%22%3A%22%232196F3%22,%22outline-color%22%3A%22%231A78C2%22,%22text-color%22%3A%22%23FFFFFF%22%7D%7D,%7B%22type%22%3A%22Feature%22,%22geometry%22%3A%7B%22type%22%3A%22Point%22,%22coordinates%22%3A%5B116.4074,39.9042%5D%7D,%22properties%22%3A%7B%22label%22%3A%22Beijing,%20China%22,%22icon%22%3A%22bubble%22,%22color%22%3A%22%23FF9800%22,%22outline-color%22%3A%22%23D76B0B%22,%22text-color%22%3A%22%23FFFFFF%22%7D%7D,%7B%22type%22%3A%22Feature%22,%22geometry%22%3A%7B%22type%22%3A%22Point%22,%22coordinates%22%3A%5B106.9101,47.918%5D%7D,%22properties%22%3A%7B%22label%22%3A%22Ulaanbaatar,%20Mongolia%22,%22icon%22%3A%22bubble%22,%22color%22%3A%22%239C27B0%22,%22outline-color%22%3A%22%237B1FA2%22,%22text-color%22%3A%22%23FFFFFF%22%7D%7D,%7B%22type%22%3A%22Feature%22,%22geometry%22%3A%7B%22type%22%3A%22Point%22,%22coordinates%22%3A%5B151.2093,-33.8688%5D%7D,%22properties%22%3A%7B%22label%22%3A%22Sydney,%20Australia%22,%22icon%22%3A%22bubble%22,%22color%22%3A%22%234CAF50%22,%22outline-color%22%3A%22%23388E3C%22,%22text-color%22%3A%22%23FFFFFF%22%7D%7D,%7B%22type%22%3A%22Feature%22,%22geometry%22%3A%7B%22type%22%3A%22Point%22,%22coordinates%22%3A%5B174.7633,-41.2865%5D%7D,%22properties%22%3A%7B%22label%22%3A%22Wellington,%20New%20Zealand%22,%22icon%22%3A%22bubble%22,%22color%22%3A%22%23FFC107%22,%22outline-color%22%3A%22%23FFA000%22,%22text-color%22%3A%22%23000000%22%7D%7D%5D%7D&key=API_KEY
```

------
#### [ Response image ]

![\[World map showing locations of major cities across continents with colored labels.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/static-change-marker-color.png)


------

# How to add a line to a static map
<a name="how-to-add-line-static"></a>

 In this topic, you'll learn how to add a line to a static map using Amazon Location Service. We'll cover the supported styling options, how to define a line using GeoJSON, and how to apply custom styles such as color, width, and outline. We'll also explore how to use different measurement units for properties like line width. 

## Supported styling
<a name="supported-styling"></a>


| Name | Type | Default | Description | 
| --- | --- | --- | --- | 
| `color` | Color | style-dependent | The line color. | 
| `width` | Integer/String | 2 | The line width. For more information, see [How to add a line to a static map](#how-to-add-line-static). | 
| `outline-color`  | Color | style-dependent | The line outline color. | 
|  `outline-width`  | Integer/String | 0 (turned off) | The width of the outline. For more information, see [How to add a line to a static map](#how-to-add-line-static). | 

## Supported unit
<a name="supported-unit"></a>


| Unit | Description | 
| --- | --- | 
| Integer, for example, `5` | Pixels | 
| String with no unit, for example `"5"` | Pixels | 
| `"px"` | Pixels | 
| `"m"` | Meters | 
|  `"km"`  | Kilometers | 
| `"mi"` | Miles | 
| `"ft"` | Feet | 
| `"yd"` | Yards | 
| `"%"` | The percentage of the default value for a specific property, in pixels. For example, if the default value for `width` is `2` pixels, then `200%` is `4` pixels. `%` is a sensitive character that must be encoded in the request URL as `%25`. | 

## Add a line
<a name="add-a-line"></a>

 In this example, you will add a line from a place in Vancouver to Stanley Park. The line is created using a GeoJSON format with defined coordinates. 

------
#### [ Request ]

```
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [-123.11813, 49.28246],
          [-123.11967, 49.28347],
          [-123.12108, 49.28439],
          [-123.12216, 49.28507],
          [-123.12688, 49.28812],
          [-123.1292, 49.28964],
          [-123.13216, 49.2916],
          [-123.13424, 49.29291],
          [-123.13649, 49.2944],
          [-123.13678, 49.29477],
          [-123.13649, 49.29569],
          [-123.13657, 49.29649],
          [-123.13701, 49.29715],
          [-123.13584, 49.29847],
          [-123.13579, 49.29935],
          [-123.13576, 49.30018],
          [-123.13574, 49.30097]
        ]
      },
      "properties": {
        "name": "To Stanley Park",
        "description": "An evening walk to Stanley Park."
      }
    }
  ]
}
```

------
#### [ Request URL ]

```
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map?style=Satellite&width=1024&height=1024&padding=200&scale-unit=KilometersMiles&geojson-overlay=%7B%22type%22%3A%22FeatureCollection%22,%22features%22%3A%5B%7B%22type%22%3A%22Feature%22,%22geometry%22%3A%7B%22type%22%3A%22LineString%22,%22coordinates%22%3A%5B%5B-123.11813,49.28246%5D,%5B-123.11967,49.28347%5D,%5B-123.12108,49.28439%5D,%5B-123.12216,49.28507%5D,%5B-123.12688,49.28812%5D,%5B-123.1292,49.28964%5D,%5B-123.13216,49.2916%5D,%5B-123.13424,49.29291%5D,%5B-123.13649,49.2944%5D,%5B-123.13678,49.29477%5D,%5B-123.13649,49.29569%5D,%5B-123.13657,49.29649%5D,%5B-123.13701,49.29715%5D,%5B-123.13584,49.29847%5D,%5B-123.13579,49.29935%5D,%5B-123.13576,49.30018%5D,%5B-123.13574,49.30097%5D%5D%7D,%22properties%22%3A%7B%22name%22%3A%22To%20Stanley%20Park%22,%22description%22%3A%22An%20evening%20walk%20to%20Stanley%20Park.%22%7D%7D%5D%7D&key=API_KEY
```

------
#### [ Response image ]

![\[Aerial view of coastal city with dense urban area, marina, and surrounding forests.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/static-add-line.png)


------

## Add styling to the line
<a name="add-styling"></a>

 In this example, you will style the line added in the previous example. This includes defining the line's color, width, outline color, and outline width to customize the visual appearance of the line on the map. 

------
#### [ Request ]

```
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [-123.11813, 49.28246],
          [-123.11967, 49.28347],
          [-123.12108, 49.28439],
          [-123.12216, 49.28507],
          [-123.12688, 49.28812],
          [-123.1292, 49.28964],
          [-123.13216, 49.2916],
          [-123.13424, 49.29291],
          [-123.13649, 49.2944],
          [-123.13678, 49.29477],
          [-123.13649, 49.29569],
          [-123.13657, 49.29649],
          [-123.13701, 49.29715],
          [-123.13584, 49.29847],
          [-123.13579, 49.29935],
          [-123.13576, 49.30018],
          [-123.13574, 49.30097]
        ]
      },
      "properties": {
        "color": "#6d34b3", 
        "width": "9m",
        "outline-color": "#a8b9cc",  
        "outline-width": "2px"
      }
    }
  ]
}
```

------
#### [ Request URL ]

```
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map?style=Satellite&width=1024&height=1024&padding=200&scale-unit=KilometersMiles&geojson-overlay=%7B%22type%22%3A%22FeatureCollection%22,%22features%22%3A%5B%7B%22type%22%3A%22Feature%22,%22geometry%22%3A%22LineString%22,%22coordinates%22%3A%5B%5B-123.11813,49.28246%5D,%5B-123.11967,49.28347%5D,%5B-123.12108,49.28439%5D,%5B-123.12216,49.28507%5D,%5B-123.12688,49.28812%5D,%5B-123.1292,49.28964%5D,%5B-123.13216,49.2916%5D,%5B-123.13424,49.29291%5D,%5B-123.13649,49.2944%5D,%5B-123.13678,49.29477%5D,%5B-123.13649,49.29569%5D,%5B-123.13657,49.29649%5D,%5B-123.13701,49.29715%5D,%5B-123.13584,49.29847%5D,%5B-123.13579,49.29935%5D,%5B-123.13576,49.30018%5D,%5B-123.13574,49.30097%5D%5D%7D,%22properties%22%3A%7B%22color%22%3A%22%236d34b3%22,%22width%22%3A%229m%22,%22outline-color%22%3A%22%23a8b9cc%22,%22outline-width%22%3A%222px%22%7D%7D%5D%7D&key=API_KEY
```

------
#### [ Response image ]

![\[Aerial view of coastal city with dense urban area, marina, and surrounding forests.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/static-add-line-styling.png)


------

# How to add a route to a static map
<a name="how-to-add-route"></a>

In this topic, you'll learn how to add a route to a static map using Amazon Location Service. You'll go through the steps to obtain a route using the CalculateRoutes API and then visualize it on a static map using GeoJSON and custom styling for points and lines. 

## Steps to add a route
<a name="steps-to-add-route"></a>

1. Get routes from the `CalculateRoutes` API. Remove coordinates that fall on the same straight line to optimize the LineString, preventing the query string from reaching its limit.

1. Create a GeoJSON object based on the optimized set of coordinates.

1. Take the first and last points of the LineString and add Point geometries to mark the start and end locations.

1. Style the points and the LineString according to your business needs, adjusting properties like color, size, and labels.

## Add a route using compact style
<a name="add-route-using-compact-style"></a>

In this example, you will add a route with start and end points to the line created in [How to add a line to a static map](how-to-add-line-static.md). The route will be defined with custom styling, including color, size, and labels for the start and end points.

```
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [-123.11813, 49.28246],
          [-123.11967, 49.28347],
          [-123.12108, 49.28439],
          [-123.12216, 49.28507],
          [-123.12688, 49.28812],
          [-123.1292, 49.28964],
          [-123.13216, 49.2916],
          [-123.13424, 49.29291],
          [-123.13649, 49.2944],
          [-123.13678, 49.29477],
          [-123.13649, 49.29569],
          [-123.13657, 49.29649],
          [-123.13701, 49.29715],
          [-123.13584, 49.29847],
          [-123.13579, 49.29935],
          [-123.13576, 49.30018],
          [-123.13574, 49.30097]
        ]
      },
      "properties": {
        "color": "#000000", 
        "width": "20m",
        "outline-color": "#a8b9cc",  
        "outline-width": "2px"
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [-123.11813, 49.28246]
      },
      "properties": {
        "label": "Pacific Centre",
        "icon": "bubble",
        "size": "large",
        "color": "#34B3A4",
        "outline-color": "#006400",
        "text-color": "#FFFFFF"
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [-123.13574, 49.30097]
      },
      "properties": {
        "label": "Stanley Park",
        "icon": "bubble",
        "size": "large",
        "color": "#B3346D",
        "outline-color": "#FF0000",
        "text-color": "#FFFFFF"
      }
    }
  ]
}
```

------
#### [ Request URL ]

```
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map?style=Satellite&width=1024&height=1024&padding=200&scale-unit=KilometersMiles&geojson-overlay=%7B%22type%22%3A%22FeatureCollection%22,%22features%22%3A%5B%7B%22type%22%3A%22Feature%22,%22geometry%22%3A%7B%22type%22%3A%22LineString%22,%22coordinates%22%3A%5B%5B-123.11813,49.28246%5D,%5B-123.11967,49.28347%5D,%5B-123.12108,49.28439%5D,%5B-123.12216,49.28507%5D,%5B-123.12688,49.28812%5D,%5B-123.1292,49.28964%5D,%5B-123.13216,49.2916%5D,%5B-123.13424,49.29291%5D,%5B-123.13649,49.2944%5D,%5B-123.13678,49.29477%5D,%5B-123.13649,49.29569%5D,%5B-123.13657,49.29649%5D,%5B-123.13701,49.29715%5D,%5B-123.13584,49.29847%5D,%5B-123.13579,49.29935%5D,%5B-123.13576,49.30018%5D,%5B-123.13574,49.30097%5D%5D%7D,%22properties%22%3A%7B%22color%22%3A%22%23000000%22,%22width%22%3A%2220m%22,%22outline-color%22%3A%22%23a8b9cc%22,%22outline-width%22%3A%222px%22%7D%7D,%7B%22type%22%3A%22Feature%22,%22geometry%22%3A%22Point%22,%22coordinates%22%3A%5B-123.11813,49.28246%5D%7D,%22properties%22%3A%7B%22label%22%3A%22Pacific%20Centre%22,%22icon%22%3A%22bubble%22,%22size%22%3A%22large%22,%22color%22%3A%22%2334B3A4%22,%22outline-color%22%3A%22%23006400%22,%22text-color%22%3A%22%23FFFFFF%22%7D%7D,%7B%22type%22%3A%22Feature%22,%22geometry%22%3A%22Point%22,%22coordinates%22%3A%5B-123.13574,49.30097%5D%7D,%22properties%22%3A%7B%22label%22%3A%22Stanley%20park%22,%22icon%22%3A%22bubble%22,%22size%22%3A%22large%22,%22color%22%3A%22%23B3346D%22,%22outline-color%22%3A%22%23FF0000%22,%22text-color%22%3A%22%23FFFFFF%22%7D%7D%5D%7D&key=API_KEY
```

------
#### [ Response image ]

![\[Aerial view of Vancouver with Stanley Park and Pacific Centre marked, showing urban layout and coastline.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/static-add-route-compact.png)


------

# How to add a polygon to a static map
<a name="how-to-add-polygon-static"></a>

Buildings and locations can be highlighted on a map by designating a polygon around them, for example, the Pentagon (located in Washington, D.C.). 

## Add a single polygon
<a name="polygon-single"></a>

In this example, you add a polygon (a pentagon) for the Pentagon building on the map.

------
#### [ Geo JSON ]

```
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "coordinates": [
          [
            [
              -77.0579282196337,
              38.87264268371487
            ],
            [
              -77.05868880963534,
              38.87003145971428
            ],
            [
              -77.05560979468949,
              38.86876862025221
            ],
            [
              -77.05305311263672,
              38.87059509268525
            ],
            [
              -77.0546384387842,
              38.872985132206225
            ],
            [
              -77.0579282196337,
              38.87264268371487
            ]
          ]
        ],
        "type": "Polygon"
      }
    }
  ]
}
```

------
#### [ Request URL ]

```
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map?style=Satellite&width=600&height=1024&padding=200&scale-unit=KilometersMiles&geojson-overlay=%7B%22type%22%3A%22FeatureCollection%22,%22features%22%3A%5B%7B%22type%22%3A%22Feature%22,%22geometry%22%3A%7B%22coordinates%22%3A%5B%5B%5B-77.0579282196337,38.87264268371487%5D,%5B-77.05868880963534,38.87003145971428%5D,%5B-77.05560979468949,38.86876862025221%5D,%5B-77.05305311263672,38.87059509268525%5D,%5B-77.0546384387842,38.872985132206225%5D,%5B-77.0579282196337,38.87264268371487%5D%5D%5D,%22type%22%3A%22Polygon%22%7D%7D%5D%7D&key=your_API_Key
```

------
#### [ Response image ]

![\[Example map showing a polygon around the Pentagon.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/mapsV2/addPolygonStaticMap.png)


------

## Add a style polygon
<a name="polygon-restyle"></a>

In this example, we restyle the polygon shown in the previous example. We draw the polygon in a different color (**\$1E3F70550**). The color components are as follows.
+ **E3** represents the red component.
+ **F7** represents the green component.
+ **05** represents the blue component.
+ **50** represents the alpha (opacity) component.

------
#### [ Geo JSON ]

```
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "coordinates": [
          [
            [
              -77.0579282196337,
              38.87264268371487
            ],
            [
              -77.05868880963534,
              38.87003145971428
            ],
            [
              -77.05560979468949,
              38.86876862025221
            ],
            [
              -77.05305311263672,
              38.87059509268525
            ],
            [
              -77.0546384387842,
              38.872985132206225
            ],
            [
              -77.0579282196337,
              38.87264268371487
            ]
          ]
        ],
        "type": "Polygon"
      },
      "properties": {
        "color": "#E3F70550"
      }
    }
  ]
}
```

------
#### [ Request URL ]

```
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map?style=Satellite&width=1024&height=1024&padding=100&scale-unit=KilometersMiles&geojson-overlay=%7B%22type%22%3A%22FeatureCollection%22,%22features%22%3A%5B%7B%22type%22%3A%22Feature%22,%22geometry%22%3A%7B%22coordinates%22%3A%5B%5B%5B-77.0579282196337,38.87264268371487%5D,%5B-77.05868880963534,38.87003145971428%5D,%5B-77.05560979468949,38.86876862025221%5D,%5B-77.05305311263672,38.87059509268525%5D,%5B-77.0546384387842,38.872985132206225%5D,%5B-77.0579282196337,38.87264268371487%5D%5D%5D,%22type%22%3A%22Polygon%22%7D,%22properties%22%3A%7B%22color%22%3A%22%23E3F70550%22%7D%7D%5D%7D&key=your_API_Key
```

------
#### [ Response image ]

![\[Example map showing a different colored polygon around the Pentagon.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/mapsV2/addPolygonStaticMap-color.png)


------

## Add multiple polygons
<a name="polygon-multiple"></a>

In this example, we add multiple polygons, to highlight multiple parks in New York City.

------
#### [ Geo JSON ]

```
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "color": "#00800050"
      },
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              -73.95824708489555,
              40.80055774655358
            ],
            [
              -73.9818875523859,
              40.76810261850716
            ],
            [
              -73.9729556303776,
              40.7642422333698
            ],
            [
              -73.94916953372382,
              40.79699323614054
            ],
            [
              -73.95824708489555,
              40.80055774655358
            ]
          ]
        ]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "color": "#FF000050"
      },
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              -73.94432602794981,
              40.80634757577718
            ],
            [
              -73.94607200977896,
              40.803869579741644
            ],
            [
              -73.94301654157768,
              40.80263972513214
            ],
            [
              -73.94127055974795,
              40.805099411561145
            ],
            [
              -73.94432602794981,
              40.80634757577718
            ]
          ]
        ]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "color": "#0000FF50"
      },
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              -73.9947948382843,
              40.7691390468232
            ],
            [
              -73.99564708262241,
              40.76802192177411
            ],
            [
              -73.99372953286147,
              40.76723992306512
            ],
            [
              -73.99289367783732,
              40.76835706126087
            ],
            [
              -73.9947948382843,
              40.7691390468232
            ]
          ]
        ]
      }
    }
  ]
}
```

------
#### [ Request URL ]

```
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map?style=Satellite&width=1024&height=1024&padding=100&scale-unit=KilometersMiles&geojson-overlay=%7B%22type%22%3A%22FeatureCollection%22,%22features%22%3A%5B%7B%22type%22%3A%22Feature%22,%22properties%22%3A%7B%22color%22%3A%22%2300800050%22%7D,%22geometry%22%3A%7B%22type%22%3A%22Polygon%22,%22coordinates%22%3A%5B%5B%5B-73.95824708489555,40.80055774655358%5D,%5B-73.9818875523859,40.76810261850716%5D,%5B-73.9729556303776,40.7642422333698%5D,%5B-73.94916953372382,40.79699323614054%5D,%5B-73.95824708489555,40.80055774655358%5D%5D%5D%7D%7D,%7B%22type%22%3A%22Feature%22,%22properties%22%3A%7B%22color%22%3A%22%23FF000050%22%7D,%22geometry%22%3A%7B%22type%22%3A%22Polygon%22,%22coordinates%22%3A%5B%5B%5B-73.94432602794981,40.80634757577718%5D,%5B-73.94607200977896,40.803869579741644%5D,%5B-73.94301654157768,40.80263972513214%5D,%5B-73.94127055974795,40.805099411561145%5D,%5B-73.94432602794981,40.80634757577718%5D%5D%5D%7D%7D,%7B%22type%22%3A%22Feature%22,%22properties%22%3A%7B%22color%22%3A%22%230000FF50%22%7D,%22geometry%22%3A%7B%22type%22%3A%22Polygon%22,%22coordinates%22%3A%5B%5B%5B-73.9947948382843,40.7691390468232%5D,%5B-73.99564708262241,40.76802192177411%5D,%5B-73.99372953286147,40.76723992306512%5D,%5B-73.99289367783732,40.76835706126087%5D,%5B-73.9947948382843,40.7691390468232%5D%5D%5D%7D%7D%5D%7D&key=your_API_Key
```

------
#### [ Response image ]

![\[Example map showing multiple polygons around parks in NYC.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/mapsV2/addPolygonStaticMap-multiple.png)


------

# How to set language for static maps
<a name="set-language-static-map"></a>

You can set the language for a static map, in case you don't want to use the default language.

In this example, a location in Tokyo which would generally default to Japanese text is requested in English, overwriting the regional default.

The example shows the response image for a request where language is provided, and one where the language is not provided. The corresponding labels reflect the difference between a map showing the requested language and a map that shows the default language.

------
#### [ Request URL - English set as the language ]

```
https://maps.geo.us-east-1.amazonaws.com/v2/static/map?center=139.4575,35.539&style=Standard&lang=en&height=700&width=700&zoom=14
```

------
#### [ Response image ]

![\[Example map showing a polygon around the Pentagon.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/mapsV2/setLanguageEnglishStaticMap.png)


------

------
#### [ Request URL - default language ]

```
https://maps.geo.us-east-1.amazonaws.com/v2/static/map?center=139.4575,35.539&style=Standard&height=700&width=700&zoom=14
```

------
#### [ Response image ]

![\[Example map showing a polygon around the Pentagon.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/mapsV2/setLanguageDefaultStaticMap.png)


------

# How to add a proximity circle to a static map
<a name="how-to-add-proximity-circle"></a>

Proximity circles offer important insights into the accuracy of a reported or estimated device or user location. By showing a circle around the reported point, users are informed that the actual position could fall anywhere within the circle, due to various factors affecting positioning precision. This added clarity helps with decision-making and enhances navigation safety.

In this example, you add a proximity circle of 500 meters near the Eiffel Tower in Paris.

------
#### [ Request ]

```
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          2.298151,
          48.855921
        ]
      },
      "properties": {
        "style": "circle",
        "color": "#007BFF50",
        "width": "500m"
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          2.298151,
          48.855921
        ]
      },
      "properties": {
        "icon": "cp",
        "color": "#007BFF",
        "text-color":"#DC3545",
        "text-outline-color":"#007BFF",
        "outline-width":"20px",
        "label": "You are here",
        "size": "large"
      }
    }
  ]
}
```

------
#### [ Request URL ]

```
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map@2x?style=Satellite&width=700&height=700&zoom=17&center=2.2958,48.8570&geojson-overlay=%7B%20%20%22type%22%3A%20%22FeatureCollection%22,%20%20%22features%22%3A%20%5B%20%20%20%20%7B%20%20%20%20%20%20%22type%22%3A%20%22Feature%22,%20%20%20%20%20%20%22geometry%22%3A%20%7B%20%20%20%20%20%20%20%20%22type%22%3A%20%22Point%22,%20%20%20%20%20%20%20%20%22coordinates%22%3A%20%5B%20%20%20%20%20%20%20%20%20%202.298151,%20%20%20%20%20%20%20%20%20%2048.855921%20%20%20%20%20%20%20%20%5D%20%20%20%20%20%20%7D,%20%20%20%20%20%20%22properties%22%3A%20%7B%20%20%20%20%20%20%20%20%22style%22%3A%20%22circle%22,%20%20%20%20%20%20%20%20%22color%22%3A%20%22%23007BFF50%22,%20%20%20%20%20%20%20%20%22width%22%3A%20%22500m%22%20%20%20%20%20%20%7D%20%20%20%20%7D,%20%20%20%20%7B%20%20%20%20%20%20%22type%22%3A%20%22Feature%22,%20%20%20%20%20%20%22geometry%22%3A%20%7B%20%20%20%20%20%20%20%20%22type%22%3A%20%22Point%22,%20%20%20%20%20%20%20%20%22coordinates%22%3A%20%5B%20%20%20%20%20%20%20%20%20%202.298151,%20%20%20%20%20%20%20%20%20%2048.855921%20%20%20%20%20%20%20%20%5D%20%20%20%20%20%20%7D,%20%20%20%20%20%20%22properties%22%3A%20%7B%20%20%20%20%20%20%20%20%22icon%22%3A%20%22cp%22,%20%20%20%20%20%20%20%20%22color%22%3A%20%22%23007BFF%22,%20%20%20%20%20%20%20%20%22text-color%22%3A%22%23DC3545%22,%20%20%20%20%20%20%20%20%22text-outline-color%22%3A%22%23007BFF%22,%20%20%20%20%20%20%20%20%22outline-width%22%3A%2220px%22,%20%20%20%20%20%20%20%20%22label%22%3A%20%22You%20are%20here%22,%20%20%20%20%20%20%20%20%22size%22%3A%20%22large%22%20%20%20%20%20%20%7D%20%20%20%20%7D%20%20%5D%7D&key=your_API_Key             
```

------
#### [ Response image ]

![\[Example map showing a proximity circle around the Eiffel Tower.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/mapsV2/addPproximityCircleStaticMap.png)


------

# Manage costs and usage
<a name="maps-whats-next"></a>

As you continue learning about Amazon Location maps, it's important to understand how to manage service capacity, ensure you follow usage limits, and get the best results through quota and API optimizations. By applying best practices for performance and accuracy, you can tailor your application to handle place-related queries efficiently and maximize your API requests.

**Topics**
+ [

# Best practices for Amazon Location Service
](maps-best-practices.md)
+ [

# Maps pricing
](maps-pricing.md)
+ [

# Map quotas and usage
](map-quota-and-usage.md)

# Best practices for Amazon Location Service
<a name="maps-best-practices"></a>

When working with Amazon Location Service, adhering to best practices ensures your maps are optimized for performance, accuracy, and user experience. This section outlines key considerations for working with static maps, geographical bounds, and GeoJSON data to enhance map functionality and visualization.

## Dynamic maps
<a name="next-dynamic-maps"></a>

The following are a few best practices for working with dynamic maps in Amazon Location Service.

### Rendering optimization with MapLibre
<a name="next-dynamic-rendering"></a>

The following are few features of MapLibre which help optimize rendering for AWS map styles. For more information, see [AWS map styles and features](map-styles.md).

#### Skip validation of style
<a name="next-dynamic-validation"></a>

If you are using the AWS map style, set `validateStyle` to `false`. This will turn off load-time style validation, speeding up the initial map load. Style validation is not needed with AWS map styles, because they are pre-validated.

------
#### [ Example ]

```
const map = new maplibregl.Map({
    container: 'map', // ID of the div where the map will render
    style: `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?key=${apiKey}`, // Map style URL
    center: [0, 0], // Starting position [lng, lat]
    zoom: 2, // Starting zoom
    validateStyle: false, // Disable style validation for faster map load
});
```

------
#### [ Explanation ]
+ `validateStyle: true`: This enables validation of the map style against the MapLibre GL style specification. If there are any issues in the style, they'll be logged in the console.
+ If you set this to `false`, the map will skip the style validation process, which might result in faster loading, but without error checking.

------

#### Pre-warm the map
<a name="next-dynamic-prewarm"></a>

For single-page applications (SPAs) that may create and destroy the map many times as the user navigates through the app, the pre-warm function can reduce delays in re-creating the map after it has been destroyed. 

This feature is only recommended for SPAs.

## Static maps
<a name="next-static-maps"></a>

### Bounds, bounding box (box)
<a name="bounds-bbox"></a>

When working with maps and geographical data, defining the bounding box (`bbox`) and bounds parameters accurately is crucial, as they determine the geographic area of interest. Any inaccuracies can lead to undesirable results.

**Ensure precise bounds**  
Ensure the specified bounds precisely represent the region you want to display. Even slight inaccuracies can crop or exclude portions of the desired area, defeating the visualization's purpose.

**Verify appropriate zoom level**  
The map's zoom level is automatically calculated based on the specified bounds or bbox. Verify that the resulting zoom level provides appropriate detail and visibility for the entire area of interest. If the zoom is too high or low, the map may fail to convey the desired information effectively.

**Check for custom overlay visibility**  
When using bbox or bounds with custom overlays like GeoJSON features, make sure the features' extent falls within the resulting map image. Features extending beyond the bounds may be clipped or omitted, leading to incomplete or misleading visualizations.

**Use padding with bbox**  
Use the bbox along with the padding parameter to ensure map features near the edges are fully visible and not cut off.

By accurately defining the bbox and bounds parameters, you can ensure your maps represent the desired geographic area correctly, provide an appropriate level of detail, and effectively incorporate custom overlays or data layers.

## GeoJSON
<a name="geojson-best-practices"></a>

When using GeoJSON data, optimizing the query string by minifying the GeoJSON can help you stay within query string limits, especially for large datasets.

# Maps pricing
<a name="maps-pricing"></a>

Amazon Location Service offers competitive pricing for its Maps API based on the type of map request and the number of API calls made. This section provides an overview of the pricing structure for dynamic and static maps. 

For detailed pricing information, see [Amazon Location Service pricing](https://aws.amazon.com/location/pricing/).

## Dynamic maps
<a name="dynamic-maps-pricing"></a>

Pricing for the Maps API is based on the number of tiles retrieved by the `GetTiles` API

Other map-related APIs, such as `GetGlyphs`, `GetStyleDescriptor`, and `GetSprites` are free of charge.

## Static map images
<a name="static-maps-pricing"></a>

Pricing for static map images is based on the number of requests made to the `GetStaticMap` API. Each request for a static map image is counted towards the pricing calculation.

# Map quotas and usage
<a name="map-quota-and-usage"></a>

Amazon Location Service imposes specific service quotas and usage limits for both dynamic and static maps. These limits are put in place to ensure fair usage and performance efficiency across all users. Below are the service quotas and adjustable limits for each service.

## Service quotas
<a name="service-quota"></a>

Amazon Location Service sets default quotas for APIs to help manage service capacity, which can be viewed in the [AWS service quotas management console](https://console.aws.amazon.com/servicequotas/home#!/services/geo/quotas). You can request an increase in quotas through the [self-service console](https://console.aws.amazon.com/servicequotas/home#!/services/geo/quotas), for up to twice the default limit for each API. 

For quota limits exceeding twice the default limit, request through the self service console and it will automatically submit a support ticket. Alternately, connect with your premium support team. 

There are no direct charges for quota increase requests, but higher usage levels may lead to increased service costs based on the additional resources consumed. For more information, see [Manage quotas with Service Quotas](manage-quotas.md).

### Dynamic map
<a name="dynamic-map-quota"></a>


| API name | Default | Max adjustable limit | More than Adjustable Max limit | 
| --- | --- | --- | --- | 
|  `GetTiles`  |  2000  |  4000  | Request on [service quota console](https://console.aws.amazon.com/servicequotas/home#!/services/geo/quotas) or contact support team | 

### Static map
<a name="static-map-quota"></a>


| API name | Default | Max adjustable limit | More than Adjustable Max limit | 
| --- | --- | --- | --- | 
|  `GetStaticMap`  |  50  |  100  | Request on [service quota console](https://console.aws.amazon.com/servicequotas/home#!/services/geo/quotas) or contact support team | 

## Usage limits
<a name="other-usage-limits"></a>


| API name | Limit | Value | 
| --- | --- | --- | 
|  `GetStyleDescriptor`  |  Max requests, per second, per IP address.  |  5000  | 
|  `GetGlyphys`  |  Max requests, per second, per IP address.  | 5000 | 
|  `GetSprites`  |  Max requests, per second, per IP address.  | 5000 | 
|  `GetStaticMap`  |  Response payload size after compression.  |  6MB  | 
|  `GetTiles`  |  Response payload size after compression.  |  6MB  | 

## Terms
<a name="terms-to-use"></a>

For more information, see [Terms of use and data attribution](data-attribution.md).