LngLatRectangle
A longitude-latitude rectangle on an ellipsoid. Angular values are stored in radians.
Usageโ
import {toRadians} from '@math.gl/core/matrix';
import {LngLatRectangle} from '@math.gl/geospatial/globe';
const rectangle = new LngLatRectangle(
toRadians(170),
toRadians(-10),
toRadians(-170),
toRadians(10)
);
const center = LngLatRectangle.center(rectangle);
Because east is smaller than west, this example crosses the antimeridian and has a width of
20 degrees.
Fieldsโ
west : Numberโ
The westernmost longitude in radians.
south : Numberโ
The southernmost latitude in radians.
east : Numberโ
The easternmost longitude in radians.
north : Numberโ
The northernmost latitude in radians.
width : Numberโ
The rectangle width in radians, accounting for antimeridian crossing.
Methodsโ
constructor(west : Number, south : Number, east : Number, north : Number)โ
Creates a longitude-latitude rectangle.
LngLatRectangle.center(rectangle : LngLatRectangle, result? : Vector3) : Vector3โ
Computes the rectangle center. The returned vector contains longitude, latitude, and a zero height.
rectangle- The rectangle whose center should be computed.result- OptionalVector3in which to store the result.
Returns the supplied result or a new Vector3.