Automatic map positioning

If the map image has at least one placemark or geometric figure (polyline or polygon), the viewport can be automatically selected, even if the URL does not specify values for the map center (ll parameter), the viewport (spn parameter), or the zoom level (z parameter). The Static API selects values for the omitted parameters so that all placemarks, polylines, and polygons are visible on the map.

If there is only one placemark set, it will be the center of the map; if a single polyline or polygon is set, the map center will be the geometric center of the area that is formed by the points of this polyline or polygon.

The following example shows a request for a map fragment of Ankara with a route from the Çankaya metro station to the Turkiye Tarim Kredi Kooperatifleri building (the start and end of the route are marked). The request does not specify the ll, z, or spn parameters:

https://static-maps.yandex.ru/v1?lang=en_US&pt=27.135483,38.422478,pm2am~27.138275,38.42422,pm2bm&pl=27.135483,38.422478,27.137685,38.422469,27.137736,38.422564,27.137789,38.424045,27.138519,38.423975,27.141899,38.423802,27.142215,38.423756,27.142333,38.423697,27.142376,38.423549,27.142596,38.423368,27.142971,38.423347,27.143285,38.423625,27.143245,38.423912,27.143015,38.424102,27.142795,38.424128,27.142795,38.424128,27.142387,38.423918,27.141909,38.423918,27.138275,38.42422&apikey=YOUR_API_KEY

If we add another placemark to the map, for example, near the Kadifekale metro station, a different map center and zoom level will be selected:

https://static-maps.yandex.ru/v1?lang=en_US&pt=27.135483,38.422478,pm2am~27.138275,38.42422,pm2bm~27.14316,38.416435,pm2vvl&pl=27.135483,38.422478,27.137685,38.422469,27.137736,38.422564,27.137789,38.424045,27.138519,38.423975,27.141899,38.423802,27.142215,38.423756,27.142333,38.423697,27.142376,38.423549,27.142596,38.423368,27.142971,38.423347,27.143285,38.423625,27.143245,38.423912,27.143015,38.424102,27.142795,38.424128,27.142795,38.424128,27.142387,38.423918,27.141909,38.423918,27.138275,38.42422&apikey=YOUR_API_KEY