LngLat class
A LngLat object represents a given longitude and latitude coordinate, measured in degrees.
Mapbox GL uses longitude, latitude coordinate order (as opposed to latitude, longitude) to match GeoJSON.
Note that any Mapbox GL method that accepts a LngLat object as an argument or option
can also accept an Array of two numbers and will perform an implicit conversion.
This flexible type is documented as {@link LngLatLike}.
@param {number} lng Longitude, measured in degrees. @param {number} lat Latitude, measured in degrees. @example var ll = new mapboxgl.LngLat(-73.9749, 40.7736); @see Get coordinates of the mouse pointer @see Display a popup @see Highlight features within a bounding box @see Create a timeline animation
Constructors
- LngLat(num lng, num lat)
-
factory
- LngLat.fromJsObject(LngLatJsImpl jsObject)
-
Creates a new LngLat from a
jsObject.
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toArray(
) → List< num> - Returns the coordinates represented as an array of two numbers.
-
toBounds(
num radius) → LngLatBounds -
Returns a
LngLatBoundsfrom the coordinates extended by a givenradius. The returnedLngLatBoundscompletely contains theradius. -
toString(
) → String -
Returns the coordinates represent as a string.
override
-
wrap(
) → LngLat -
Returns a new
LngLatobject whose longitude is wrapped to the range (-180, 180).
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited