LngLatBounds class

A LngLatBounds object represents a geographical bounding box, defined by its southwest and northeast points in longitude and latitude.

If no arguments are provided to the constructor, a null bounding box is created.

Note that any Mapbox GL method that accepts a LngLatBounds object as an argument or option can also accept an Array of two {@link LngLatLike} constructs and will perform an implicit conversion. This flexible type is documented as {@link LngLatBoundsLike}.

@param {LngLatLike} sw The southwest corner of the bounding box. @param {LngLatLike} ne The northeast corner of the bounding box. @example var sw = new mapboxgl.LngLat(-73.9876, 40.7661); var ne = new mapboxgl.LngLat(-73.9397, 40.8002); var llb = new mapboxgl.LngLatBounds(sw, ne);

Constructors

LngLatBounds(LngLat sw, LngLat ne)
factory
LngLatBounds.fromJsObject(LngLatBoundsJsImpl jsObject)
Creates a new LngLatBounds from a jsObject.

Properties

hashCode int
The hash code for this object.
no setterinherited
jsObject → LngLatBoundsJsImpl
JS object.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

contains(LngLat lnglat) bool
Check if the point is within the bounding box.
extend(dynamic obj) LngLatBounds
Extend the bounds to include a given LngLat or LngLatBounds.
getCenter() LngLat
Returns the geographical coordinate equidistant from the bounding box's corners.
getEast() num
Returns the east edge of the bounding box.
getNorth() num
Returns the north edge of the bounding box.
getNorthEast() LngLat
Returns the northeast corner of the bounding box.
getNorthWest() LngLat
Returns the northwest corner of the bounding box.
getSouth() num
Returns the south edge of the bounding box.
getSouthEast() LngLat
Returns the southeast corner of the bounding box.
getSouthWest() LngLat
Returns the southwest corner of the bounding box.
getWest() num
Returns the west edge of the bounding box.
isEmpty() bool
Check if the bounding box is an empty/null-type box.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setNorthEast(LngLat ne) LngLatBounds
Set the northeast corner of the bounding box
setSouthWest(LngLat sw) LngLatBounds
Set the southwest corner of the bounding box
toArray() List<List<num>>
Returns the bounding box represented as an array.
toString() String
Return the bounding box represented as a string.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

convert(dynamic input) LngLatBounds
Converts an array to a LngLatBounds object.