google.maps.LatLngBounds class
A LatLngBounds instance represents a rectangle in geographical coordinates, including one that crosses the 180 degrees longitudinal meridian.
Constructor
LatLngBounds([sw, ne])
Parameters:
- sw: LatLng|LatLngLiteral optional
- ne: LatLng|LatLngLiteral optional
Constructs a rectangle from the points at its south-west and north-east corners.
Methods
contains(latLng)
Parameters:
- latLng: LatLng|LatLngLiteral
Return Value: boolean
Returns true if the given lat/lng is in this bounds.
equals(other)
Parameters:
- other: LatLngBounds|LatLngBoundsLiteral
Return Value: boolean
Returns true if this bounds approximately equals the given bounds.
extend(point)
Parameters:
- point: LatLng|LatLngLiteral
Return Value: LatLngBounds
Extends this bounds to contain the given point.
getCenter()
Parameters: None
Return Value: LatLng
Computes the center of this LatLngBounds
getNorthEast()
Parameters: None
Return Value: LatLng
Returns the north-east corner of this bounds.
getSouthWest()
Parameters: None
Return Value: LatLng
Returns the south-west corner of this bounds.
intersects(other)
Parameters:
- other: LatLngBounds|LatLngBoundsLiteral
Return Value: boolean
Returns true if this bounds shares any points with the other bounds.
isEmpty()
Parameters: None
Return Value: boolean
Returns if the bounds are empty.
toJSON()
Parameters: None
Return Value: LatLngBoundsLiteral
Converts to JSON representation. This function is intended to be used via JSON.stringify.
toSpan()
Parameters: None
Return Value: LatLng
Converts the given map bounds to a lat/lng span.
toString()
Parameters: None
Return Value: string
Converts to string.
toUrlValue([precision])
Parameters:
- precision: number optional
Return Value: string
Returns a string of the form "lat_lo,lng_lo,lat_hi,lng_hi" for this bounds, where "lo" corresponds to the southwest corner of the bounding box, while "hi" corresponds to the northeast corner of that box.
union(other)
Parameters:
- other: LatLngBounds|LatLngBoundsLiteral
Return Value: LatLngBounds
Extends this bounds to contain the union of this and the given bounds.