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 requests a section of the map of Ankara showing a route from the metro station Çankaya to the building of Turkiye Tarim Kredi Kooperatifleri (the start and finish of the route are marked with placemarks). The request does not specify the ll, z or spn parameters:

https://static-maps.yandex.ru/1.x/?lang=&l=map&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

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

https://static-maps.yandex.ru/1.x/?lang=&l=map&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