Constructs an Extent object.
Rest
...values: InputVariable number of arguments. The following combinations are supported:
west
, east
, south
, north
propertiesminx
, maxx
, miny
, maxy
Private
_crsPrivate
Readonly
_valuesthe coordinates of the bottom right corner
the coordinates of the bottom right corner
Sets target
with the center of this extent.
Optional
target: Coordinates | Vector2the object to set with the center's X. If none provided, a new one is created.
the modified object passed in argument.
Sets the target with the width and height of this extent.
The x
property will be set with the width,
and the y
property will be set with the height.
the optional target to set with the result.
the modified object passed in argument, or a new object if none was provided.
Returns true
if the two extents are equal.
The extent to compare.
The optional comparison epsilon.
true
if the extents are equal, otherwise false
.
Expands the extent to contain the specified coordinates.
The coordinates to include
Returns an extent that is adjusted so that its edges land exactly at the border of the grid pixels. Optionally, you can specify the minimum pixel size of the resulting extent.
The grid extent.
The grid width, in pixels.
The grid height, in pixels.
Optional
minPixWidth: numberThe minimum width, in pixels, of the resulting extent.
Optional
minPixHeight: numberThe minimum height, in pixels, of the resulting extent.
The adjusted extent and pixel size of the adjusted extent.
Returns true
if this bounding box intersect with the bouding box parameter
the bounding box to test
true
if this bounding box intersects with the provided bounding box
Tests whether this extent is contained in another extent.
the other extent to test
the precision delta (+/- epsilon). If this value is not provided, a reasonable epsilon will be computed.
true
if this extent is contained in the other extent.
Checks whether the specified coordinate is inside this extent.
the coordinate to test
the precision delta (+/- epsilon)
true
if the coordinate is inside the bounding box
Returns the normalized offset from bottom-left in extent of this Coordinates
the coordinate
optional Vector2 target. If not present a new one will be created
normalized offset in extent
extent.offsetInExtent(extent.center())
// returns `(0.5, 0.5)`.
Subdivides this extents into x and y subdivisions.
Notes:
1
, an array of one element is returned,
containing a copy of this extent.The number of subdivisions on the X/longitude axis.
The number of subdivisions on the Y/latitude axis.
the resulting extents.
const extent = new Extent('EPSG:3857', 0, 100, 0, 100);
extent.split(2, 1);
// [0, 50, 0, 50], [50, 100, 50, 100]
Returns a Box3 that matches this extent.
The min height of the box.
The max height of the box.
The box.
the coordinates of the top left corner
the coordinates of the top right corner
Returns an extent with a margin.
The horizontal margin, in CRS units.
The vertical margin, in CRS units.
a new extent with a specified margin applied.
const extent = new Extent('EPSG:3857', 0, 100, 0, 100);
const margin = extent.withMargin(10, 15);
// new Extent('EPSG:3857', -10, 110, -15, 115);
Returns an extent with a relative margin added.
The margin, in normalized value ([0, 1]). A margin of 1 means 100% of the width or height of the extent.
a new extent with a specified margin applied.
const extent = new Extent('EPSG:3857', 0, 100, 0, 100);
const margin = extent.withRelativeMargin(0.1);
// new Extent('EPSG:3857', -10, 110, -10, 110);
Static
fromStatic
fromReturns an extent centered at the specified coordinate, and with the specified size.
The CRS identifier.
The center.
The center X.
The center Y.
The width, in CRS units.
The height, in CRS units.
The produced extent.
Generated using TypeDoc
An object representing a spatial extent. It encapsulates a Coordinate Reference System id (CRS) and coordinates.
It leverages proj4js to do the heavy-lifting of defining and transforming coordinates between reference systems. As a consequence, every EPSG code known by proj4js can be used out of the box, as such:
For other EPSG codes, you must register them with
Instance.registerCRS()
: