LatLngBounds Class

September 29, 2018 ยท View on GitHub

let bounds: LatLngBounds = new LatLngBounds([
  {"lat": ..., "lng": ...}),
  {"lat": ..., "lng": ...}),
  {"lat": ..., "lng": ...}),
  {"lat": ..., "lng": ...})
]);

new LatLngBounds(points?)

Params Type Details
points LatLngBounds[] (optional)ILatLng[]

Instance properties

Params Type Details
northeast ILatLng The northeast of the bounds that contains the farLeft, farRight, nearLeft and nearRight. Since the map view is able to rotate, the farRight is not the same as the northeast.
southwest ILatLng The southwest of the bounds that contains the farLeft, farRight, nearLeft and nearRight. Since the map view is able to rotate, the nearLeft is not the same as the southwest.
type string `LatLngBounds`

Instance method

toString()

Converts to string

:arrow_right: Returns string

toUrlValue(precision?)

Returns a string of the form "lat_sw,lng_sw,lat_ne,lng_ne" for this bounds, where "sw" corresponds to the southwest corner of the bounding box, while "ne" corresponds to the northeast corner of that box.

Params Type Details
precision number (optional)precision. Default is 6

:arrow_right: Returns string

extend(latLng)

Extends this bounds to contain the given point.

Params Type Details
latLng ILatLng another point

contains(latLng)

Returns true if the given lat/lng is in this bounds.

Params Type Details
latLng ILatLng point

:arrow_right: Returns boolean

getCenter()

Computes the center of this LatLngBounds

:arrow_right: Returns LatLng