Viewport

There are two ways to define the map viewport:

  • Using the bbox parameter.
  • Using the ll+spn parameters.

The Static API selects the appropriate zoom level so that the entire specified area is visible on the image.

If the bbox and ll+spn parameters are omitted and the zoom level isn't explicitly defined (the z parameter), the Static API tries to set the missing parameters automatically.

bbox parameter

The bbox parameter sets the geographical coordinates of the corners of a rectangle bounding the viewport. The coordinates of the lower-left and upper-right corners are specified (in the order "longitude, latitude").

Note. If bbox and ll+spn are both set at the same time, the bbox parameter takes priority.

Example

ll+spn parameters

The ll+spn parameters set the span of the viewport relative to the map center.

The ll parameter defines the longitude and latitude of the map center (in degrees), while spn defines its range (in degrees). The span of the area is defined by two numbers; the first is the difference between the maximum and minimum longitude of the area, and the second is the difference between the maximum and minimum latitude.

Note. If bbox and ll+spn are both set at the same time, the bbox parameter takes priority.

Examples

The examples below show map image requests that differ from each other only by the viewport size (0.002x0.002, 0.3x0.3 and 10x10 degrees). The center of the requested map fragment is Taksim Meydanı in Istanbul, and the map size is 300x300 pixels.

Viewport of 0.002x0.002 degrees:

https://static-maps.yandex.ru/1.x/?lang=tr_TR&ll=28.98513,41.036943&spn=0.002,0.002&size=300,300&l=map

Viewport of 0.3x0.3 degrees:

https://static-maps.yandex.ru/1.x/?lang=tr_TR&ll=28.98513,41.036943&spn=0.3,0.3&size=300,300&l=map

Viewport of 10x10 degrees:

https://static-maps.yandex.ru/1.x/?lang=tr_TR&ll=28.98513,41.036943&spn=10,10&size=300,300&l=map