Constructs an Extent object.
Rest
...values: ExtentParametersThe extent values.
Gets the coordinate reference system of this extent.
the horizontal coordinate of the easternmost side
the horizontal coordinate of the northernmost side
the horizontal coordinate of the southermost side
the horizontal coordinate of the westernmost side
Static
WGS84Static
webthe coordinates of the bottom right corner
the coordinates of the bottom right corner
Sets target
with the center of this extent.
Optional
target: Coordinatesthe coordinate to set with the center's coordinates. If none provided, a new one is created.
the modified object passed in argument.
Sets target
with the center of this extent.
Note: The z coordinate of the resulting vector will be set to zero.
Optional
target: Vector3the vector to set with the center's coordinates. 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.
Set this extent to the intersection of itself and other
the bounding box to intersect
the modified 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)`.
Set the coordinate reference system and values of this extent.
the new CRS
Rest
...values: ExtentParametersthe new values
this object modified
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]
Divides this extent into a regular grid. The number of points in each direction is equal to the number of subdivisions + 1. The points are laid out row-wise, from west to east, and north to south:
1 -- 2
| |
3 -- 4
The number of grid subdivisions in the x-axis.
The number of grid subdivisions in the y-axis.
The array to fill.
The number of elements per item (2 for XY, 3 for XYZ).
the target.
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 width, in CRS units.
The height, in CRS units.
The produced extent.
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()
: