Module: ol/extent

ol/extent


import * as olExtent from 'ol/extent';

Functions

applyTransform(extent, transformFn, dest, stops){Extent}

import {applyTransform} from 'ol/extent';

Apply a transform function to the extent.

Name Type Description
extent Extent

Extent.

transformFn TransformFunction

Transform function. Called with [minX, minY, maxX, maxY] extent coordinates.

dest Extent | undefined

Destination extent.

stops number | undefined

Number of stops per side used for the transform. By default only the corners are used.

Returns:
Extent.

boundingExtent(coordinates){Extent}

import {boundingExtent} from 'ol/extent';

Build an extent that includes all given coordinates.

Name Type Description
coordinates Array<Coordinate>

Coordinates.

Returns:
Bounding extent.

buffer(extent, value, dest){Extent}

import {buffer} from 'ol/extent';

Return extent increased by the provided value.

Name Type Description
extent Extent

Extent.

value number

The amount by which the extent should be buffered.

dest Extent | undefined

Extent.

Returns:
Extent.

containsCoordinate(extent, coordinate){boolean}

import {containsCoordinate} from 'ol/extent';

Check if the passed coordinate is contained or on the edge of the extent.

Name Type Description
extent Extent

Extent.

coordinate Coordinate

Coordinate.

Returns:
The coordinate is contained in the extent.

containsExtent(extent1, extent2){boolean}

import {containsExtent} from 'ol/extent';

Check if one extent contains another.

An extent is deemed contained if it lies completely within the other extent, including if they share one or more edges.

Name Type Description
extent1 Extent

Extent 1.

extent2 Extent

Extent 2.

Returns:
The second extent is contained by or on the edge of the first.

containsXY(extent, x, y){boolean}

import {containsXY} from 'ol/extent';

Check if the passed coordinate is contained or on the edge of the extent.

Name Type Description
extent Extent

Extent.

x number

X coordinate.

y number

Y coordinate.

Returns:
The x, y values are contained in the extent.

createEmpty(){Extent}

import {createEmpty} from 'ol/extent';

Create an empty extent.

Returns:
Empty extent.

equals(extent1, extent2){boolean}

import {equals} from 'ol/extent';

Determine if two extents are equivalent.

Name Type Description
extent1 Extent

Extent 1.

extent2 Extent

Extent 2.

Returns:
The two extents are equivalent.

extend(extent1, extent2){Extent}

import {extend} from 'ol/extent';

Modify an extent to include another extent.

Name Type Description
extent1 Extent

The extent to be modified.

extent2 Extent

The extent that will be included in the first.

Returns:
A reference to the first (extended) extent.

getArea(extent){number}

import {getArea} from 'ol/extent';

Get the size of an extent.

Name Type Description
extent Extent

Extent.

Returns:
Area.

getBottomLeft(extent){Coordinate}

import {getBottomLeft} from 'ol/extent';

Get the bottom left coordinate of an extent.

Name Type Description
extent Extent

Extent.

Returns:
Bottom left coordinate.

getBottomRight(extent){Coordinate}

import {getBottomRight} from 'ol/extent';

Get the bottom right coordinate of an extent.

Name Type Description
extent Extent

Extent.

Returns:
Bottom right coordinate.

getCenter(extent){Coordinate}

import {getCenter} from 'ol/extent';

Get the center coordinate of an extent.

Name Type Description
extent Extent

Extent.

Returns:
Center.

getHeight(extent){number}

import {getHeight} from 'ol/extent';

Get the height of an extent.

Name Type Description
extent Extent

Extent.

Returns:
Height.

getIntersection(extent1, extent2, dest){Extent}

import {getIntersection} from 'ol/extent';

Get the intersection of two extents.

Name Type Description
extent1 Extent

Extent 1.

extent2 Extent

Extent 2.

dest Extent | undefined

Optional extent to populate with intersection.

Returns:
Intersecting extent.

getSize(extent){Size}

import {getSize} from 'ol/extent';

Get the size (width, height) of an extent.

Name Type Description
extent Extent

The extent.

Returns:
The extent size.

getTopLeft(extent){Coordinate}

import {getTopLeft} from 'ol/extent';

Get the top left coordinate of an extent.

Name Type Description
extent Extent

Extent.

Returns:
Top left coordinate.

getTopRight(extent){Coordinate}

import {getTopRight} from 'ol/extent';

Get the top right coordinate of an extent.

Name Type Description
extent Extent

Extent.

Returns:
Top right coordinate.

getWidth(extent){number}

import {getWidth} from 'ol/extent';

Get the width of an extent.

Name Type Description
extent Extent

Extent.

Returns:
Width.

intersects(extent1, extent2){boolean}

import {intersects} from 'ol/extent';

Determine if one extent intersects another.

Name Type Description
extent1 Extent

Extent 1.

extent2 Extent

Extent.

Returns:
The two extents intersect.

isEmpty(extent){boolean}

import {isEmpty} from 'ol/extent';

Determine if an extent is empty.

Name Type Description
extent Extent

Extent.

Returns:
Is empty.

Type Definitions

Corner{'bottom-left'} {'bottom-right'} {'top-left'} {'top-right'}

Extent corner.

Extent{Array.<number>}

An array of numbers representing an extent: [minx, miny, maxx, maxy].