---
title: "Define area of static map image | Guides | Maps apis | Static maps"
description: "Learn how to define the area for static map images."
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Define area of static map image

This page explains in detail how the API URL for a [static map](https://docs.maptiler.com/guides/maps-apis/static-maps/static-maps-for-your-web/) is constructed. Using this knowledge, you can manually modify the output from our visual [static map generator](https://www.maptiler.com/cloud/static-maps/generator/), or you can create the URL from scratch.

## By center

To define your map image by its center, use this URL format:

`https://api.maptiler.com/maps/{mapId}/static/{longitude},{latitude},{zoom}/{width}x{height}.{format}?key=YOUR_MAPTILER_API_KEY_HERE`

### Parameters

-   **mapId** – The map ID identifies the map (style) that should be used. You can pick any ready-made MapTiler map or your own custom map: [Go to your MapTiler account](https://cloud.maptiler.com/maps/), click on any map, and copy its map ID from the address bar. For example, in the address `https://cloud.maptiler.com/maps/streets-v4/` the map ID is “streets-v4”. Your custom maps will have IDs consisting of random letters and numbers.
-   **lng, lat** – Any location on Earth can be uniquely described by its coordinates: longitude and latitude. [Get your coordinates here.](https://www.maptiler.com/tools/coordinates)
-   **zoom** – Zoom level can range from 0 (whole world) to 22 (most detailed view).
-   **width, height** – The image dimensions in pixels.
-   **format** – The image format, for example `PNG`. See the [API reference](https://docs.maptiler.com/cloud/api/static-maps/#tag/static-maps/GET/maps/{mapId}/static/{lon},{lat},{zoom}/{width}x{height}{scale}.{format}.path.format) for all supported formats.
-   **key** – Replace `YOUR_MAPTILER_API_KEY_HERE` with [your own API key](https://cloud.maptiler.com/account/keys/). Make sure to [secure the key](https://docs.maptiler.com/guides/developer/credentials/api-key/#secure-key) before you publish it.

_Bearing and pitch aren’t supported at the moment._

### Example

[https://api.maptiler.com/maps/dataviz-v4/static/8.581627,47.137726,16/825x350.png?key=YOUR\_MAPTILER\_API\_KEY\_HERE](https://api.maptiler.com/maps/dataviz-v4/static/8.581627,47.137726,16/825x350.png?key=mNLmXyaTH4gRlwJHSYWp)

![Define a static map by center point](../img/center-based.png)

### Get HiDPI resolution

For Retina and other high resolution displays, add `@2x` before the file extension to increase scale. This renders the map image in double resolution.

#### Example

[https://api.maptiler.com/maps/dataviz-v4/static/8.581627,47.137726,16/825x350@2x.png?key=YOUR\_MAPTILER\_API\_KEY\_HERE](https://api.maptiler.com/maps/dataviz-v4/static/8.581627,47.137726,16/825x350@2x.png?key=mNLmXyaTH4gRlwJHSYWp)

## By bounds

To define your map area by a bounding box, use this format:

`https://api.maptiler.com/maps/{mapId}/static/{minx},{miny},{maxx},{maxy}/{width}x{height}.{format}?key=YOUR_MAPTILER_API_KEY_HERE`

Parameters are the same as in a center-based URL, except:

-   **minx, miny** – Coordinates of the _lower left_ corner of the bounding box.
-   **maxx, maxy** – Coordinates of the _upper right_ corner of the bounding box. The most convenient way to get the bounding box coordinates is to use the [visual generator](https://www.maptiler.com/cloud/static-maps/generator/).

### Example

[https://api.maptiler.com/maps/base-v4/static/-70.3,-46.5,70.3,46.5/825x350.png?key=YOUR\_MAPTILER\_API\_KEY\_HERE](https://api.maptiler.com/maps/base-v4/static/-70.3,-46.5,70.3,46.5/825x350.png?key=mNLmXyaTH4gRlwJHSYWp)

![Define a static map by bounding box](../img/bounding-box.png)

## Auto-fit

If you add at least one marker, line, or polygon to your static map, you can use `auto` instead of center or bounds. This will calculate the image area automatically so that all markers and paths in your query are visible. To learn more, see 👉 [Static map with markers](https://docs.maptiler.com/guides/maps-apis/static-maps/static-map-with-markers/) and [Static map with lines or polygons](https://docs.maptiler.com/guides/maps-apis/static-maps/static-map-with-lines/).
