geom.Bounds()

class geom.Bounds(config)

Create a new bounds given minX, minY, maxX, maxY, and an optional projection.

Example Use

Sample code to create a new bounds:

>> var Bounds = require("geoscript/geom").Bounds;
>> var bounds = Bounds({
..   minX: -180, maxX: 180, minY: -90, maxY: 90
.. });
>> bounds.width
360
>> bounds.height
180

Sample code to create a new bounds with a projection:

>> var bounds = Bounds({
..   minX: -180, maxX: 180, minY: -90, maxY: 90, projection: "epsg:4326"
.. });
>> bounds.projection
<Projection EPSG:4326>

Sample code to create a new bounds from an array of [minX, minY, maxX, maxY] values:

>> var bounds = Bounds([-180, -90, 180, 90]);

Properties

Bounds.area

Number The are of this bounds.

Bounds.empty

Boolean Empty bounds have zero width and height.

Bounds.height

Number The difference between the maximum and minimum x values.

Bounds.maxX

Number The maximum value in the first (x) dimension for this bounds.

Bounds.maxY

Number The maximum value in the second (y) dimension for this bounds.

Bounds.minX

Number The minimum value in the first (x) dimension for this bounds.

Bounds.minY

Number The minimum value in the second (y) dimension for this bounds.

Bounds.projection

proj.Projection() The coordinate reference system for the bounds (if specified). Setting this value will not transform coordinates of the bounds. To transform a bounds from one projection to another, use the transform() method.

Methods

Bounds.clone()
Returns

geom.Bounds()

Generate a copy of this bounds.

Bounds.contains()
Arguments
Returns

Boolean

Determine if the given point or geometry lies in the interior or on the boundary of this bounds.

Bounds.equals()
Arguments
Returns

Boolean

Determine if two bounds are equivalent.

Bounds.include()
Arguments
Returns

geom.Bounds() This bounds.

Extends this bounds as necessary to include the given bounds or geometry. Modifies this bounds.

Bounds.intersection()
Arguments
Returns

geom.Bounds()

Generate a bounds that is the intersection of this bounds with the given bounds.

Bounds.intersects()
Arguments
Returns

Boolean

Determine if the interiors or edges of two bounds intersect. If a geometry is given, intersection will be determined as if this bounds were a polygon.

Bounds.toArray()
Returns

Array

Return an array containing [minX, minY, maxX, maxY] values for this bounds.

Bounds.toPolygon()
Returns

geom.Polygon()

Generate a polygon with the corner coordinates of this bounds.

Bounds.transform()
Arguments
Returns

geom.Bounds()

Generate the bounds of the geometry that results from transforming this bounds to another projection. This bounds must have a projection set before calling this method.