Bounds
Bounds for map viewport
fitBounds
takes bounds and opt as arguments and sets the center of the map with the given parameter. bounds parameter is a JSON object with two intercardinal directions (sw and ne), with latitude and longitude (lat, lng) respectively.
Parameter
Required Parameter
Description
Type
bounds
Center these bounds in the viewport and use the highest zoom level up to and including the map.
JSON
Optional Parameter
Description
Type
padding
The amount of padding in pixels to add to the given bounds.
Numeric
linear
If true, the map transitions using Map#easeTo. If false, the map transitions using Map#flyTo.
Bool
maxZoom
The maximum zoom level to allow when the map view transitions to the specified bounds.
Numeric
Example
getBounds
Retrieves the bounds attribute set in 'fitBounds()'
Return
Intercardinal coordinates (ne, sw) with latitude and longitude
Last updated