Bounds

fitBounds(bounds,option)

Description

Obtain two coordinate values, north-eastern(ne) and south-western(ne) longitude and latitude, and move them to the center coordinated of the range.

Parameter

bounds (object)
Center these bounds in the viewport and use the highest zoom level up to and including Map#getMaxZoom() that fits them in the viewport.
> option (object)- not must
The amount of padding in pixels to add to the given bounds.

Example

 let fit = {
         sw: {lat: 37.457464, lng: 126.899302},
         ne: {lat: 37.645804, lng: 127.161728}
     }
 let opt = {
        top: 10,
        bottom: 10,
        right: 10,
        left: 10
     }
     map.fitBounds(fit,opt);

getBounds()

Description

Gets the two coordinate value(north-east, south-west) longitude/latitude) set in 'fitBounds'.

Return Value

bounds (object)

Example

map.getBounds()
return : ne: {lat: 37.645804, lng: 127.161728}
         sw: {lat: 37.457464, lng: 126.899302}