Class LatLngBounds

Index

Constructor methods

Methods

Constructor methods

constructor(southWest: LatLng, northEast: LatLng): LatLngBounds

Creates a LatLngBounds object by defining south-west and north-east corners of the rectangle.

Parameters

Returns

LatLngBounds

constructor(latlngs: LatLng[]): LatLngBounds

Creates a LatLngBounds object defined by the geographical points it contains. Very useful for zooming the map to fit a particular set of locations with fitBounds.

Parameters

Returns

LatLngBounds

Methods

public contains(otherBounds: LatLngBounds): boolean

Returns true if the rectangle contains the given one.

Parameters

Returns

boolean

public contains(latlng: LatLng): boolean

Returns true if the rectangle contains the given point.

Parameters

Returns

boolean

public equals(otherBounds: LatLngBounds): boolean

Returns true if the rectangle is equivalent (within a small margin of error) to the given bounds.

Parameters

Returns

boolean

public extend(latlng: LatLng): LatLngBounds

Extends the bounds to contain the given point.

Parameters

Returns

LatLngBounds

public extend(latlng: LatLngBounds): LatLngBounds

Extends the bounds to contain the given bounds.

Parameters

Returns

LatLngBounds

public getCenter(): LatLng

Returns the center point of the bounds.

Returns

LatLng

public getNorthEast(): LatLng

Returns the north-east point of the bounds.

Returns

LatLng

public getNorthWest(): LatLng

Returns the north-west point of the bounds.

Returns

LatLng

public getSouthEast(): LatLng

Returns the south-east point of the bounds.

Returns

LatLng

public getSouthWest(): LatLng

Returns the south-west point of the bounds.

Returns

LatLng

public intersects(otherBounds: LatLngBounds): boolean

Returns true if the rectangle intersects the given bounds.

Parameters

Returns

boolean

public isValid(): boolean

Returns true if the bounds are properly initialized.

Returns

boolean

public pad(bufferRatio: number): LatLngBounds

Returns bigger bounds created by extending the current bounds by a given percentage in each direction.

Parameters

  • bufferRatio: number

Returns

LatLngBounds

public toBBoxString(): string

Returns a string with bounding box coordinates in a 'southwest_lng,southwest_lat,northeast_lng,northeast_lat' format. Useful for sending requests to web services that return geo data.

Returns

string