

# 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.