API for static maps
If you don’t need an interactive map but a static image will suffice, you can use the Static Maps function. You don’t need any map libraries or Javascript; you can call the function directly in the <img src=””…> tag. Using the parameters of this function, you can choose the image size, map type, displayed area, and you can add markers to the map.
The image on the right is generated using the static maps function.
See the Tutorials for more usage examples.
Technical Documentation
https://api.mapy.cz/v1/docs/static/
The technical documentation contains a precise description of the input and output parameters, default values, errors, and other details.
Function Descriptions
- Static Map – The function returns an image in the chosen format (png, jpg, etc.) and size, containing a map according to the provided parameters
Note: The images obtained from this function are intended for online display only. They cannot be stored or cached long-term – see the terms of service.
Input Parameters
Basic Parameters | |
mapset | Map set – Basic map (basic) – Tourist map (outdoor) – Aerial map (aerial) – pure aerial map without labels – Aerial map with labels (aerial-names-overlay) – Winter map (winter) |
width, height | Desired image size in pixels. Maximum size is 1024 px |
scale | 1 – standard resolution, 2 – retina resolution (resulting image will have double size) |
format | png, jpg, webp, gif |
lang | Preferred language. The chosen value affects only zoom <= 6. Country names are displayed in English for all selected languages except cs, sk. |
debug | In case of an error with debug=true set, the error details are output in JSON format |
Parameters for Selecting the Displayed Area | |
lon, lat | 1 – Coordinates defining the center of the map on the image. Used in combination with the zoom parameter 2 – If lon and lat are used twice, they are interpreted as a bounding box, i.e., the top left and bottom right corners of the rectangle to be displayed on the image. In this case, zoom is calculated automatically and specifying it makes no sense. 3 – The last option is not to specify coordinates (and zoom) at all. Then, the best fit is used for overlay layers (e.g., markers) |
zoom | Desired map zoom level |
padding | Margin in pixels around the displayed area, used in case of options 2 or 3 |
Displaying Additional Layers on the Map | |
markers | Adding markers on the map. Markers are specified in this format: markers=color:red;size:large;label:R;14.422,50.089 mandatory part – Coordinates – Multiple coordinates can be specified in succession, creating multiple markers in the set style optional – Color – Marker color – Size – Marker size – Label – Max. two-character marker label – Label-color – Label color The markers parameter can be specified repeatedly to display multiple markers in different styles. Details see in the technical documentation |
shapes | Add lines or closed polygons above the map. mandatory part: – path or polygon + field of coordinates – see the technical documentation for the exact format optional – color – line color – fill – fill color – width – line width the shapes parameter can be specified repeatedly to display multiple shapes in different styles. Details see in the technical documentation |