Skip to content
import Extent from "@arcgis/core/geometry/Extent.js";
Inheritance:
ExtentGeometryAccessor
Since
ArcGIS Maps SDK for JavaScript 4.0

The minimum and maximum X and Y coordinates of a bounding box. Extent is used to describe the visible portion of a MapView. When working in a SceneView, Camera is used to define the visible part of the map within the view.

See also

Constructors

Constructor

Constructor
Parameters
ParameterTypeDescriptionRequired
properties
See the properties table for a list of all the properties that may be passed into the constructor.

Properties

Any properties can be set, retrieved or listened to. See the Watch for changes topic.
PropertyTypeClass
cache
readonly inherited
center
readonly
declaredClass
readonly inherited
extent
readonly inherited
hasM
readonly
hasZ
readonly
height
readonly
type
readonly
"extent"
width
readonly

cache

readonlyinherited Property
Type
Record<string, any>
Inherited from: Geometry

The cache is used to store values computed from geometries that need to be cleared or recomputed upon mutation. An example is the extent of a polygon.

center

readonly Property
Type
Point

The center point of the extent in map units.

declaredClass

readonlyinherited Property
Type
string
Inherited from: Accessor
Since
ArcGIS Maps SDK for JavaScript 4.7

The name of the class. The declared class name is formatted as esri.folder.className.

extent

readonlyinherited Property
Type
Extent | null | undefined
Inherited from: Geometry

The extent of the geometry. For a point, the extent is null.

hasM

readonly Property
Type
boolean

Indicates if the geometry has M values.

hasZ

readonly Property
Type
boolean

Indicates if the geometry has z-values (elevation).

Z-values defined in a geographic or metric coordinate system are expressed in meters. However, in local scenes that use a projected coordinate system, vertical units are assumed to be the same as the horizontal units specified by the service.

height

readonly Property
Type
number

The height of the extent in map units (the distance between ymin and ymax).

mmax

Property
Type
number | undefined

The maximum possible m value in an extent envelope.

mmin

Property
Type
number | undefined

The minimum possible m value of an extent envelope.

spatialReference

autocast Property
Type
SpatialReference

The spatial reference of the geometry.

type

readonly Property
Type
"extent"

The geometry type.

width

readonly Property
Type
number

The width of the extent in map units (the distance between xmin and xmax).

xmax

Property
Type
number

The maximum X-coordinate of an extent envelope.

Default value
0

xmin

Property
Type
number

The minimum X-coordinate of an extent envelope.

Default value
0

ymax

Property
Type
number

The maximum Y-coordinate of an extent envelope.

Default value
0

ymin

Property
Type
number

The minimum Y-coordinate of an extent envelope.

Default value
0

zmax

Property
Type
number | undefined

The maximum possible z, or elevation, value in an extent envelope.

Z-values defined in a geographic or metric coordinate system are expressed in meters. However, in local scenes that use a projected coordinate system, vertical units are assumed to be the same as the horizontal units specified by the service.

zmin

Property
Type
number | undefined

The minimum possible z, or elevation, value of an extent envelope.

Z-values defined in a geographic or metric coordinate system are expressed in meters. However, in local scenes that use a projected coordinate system, vertical units are assumed to be the same as the horizontal units specified by the service.

Methods

MethodSignatureClass
fromJSON
inherited static
fromJSON(json: any): any
centerAt(point: Point): this
clone(): Extent
contains(geometry: Point | Extent): boolean
equals(extent: Extent | null | undefined): boolean
expand(factor: number): this
intersection(extent: Extent | null | undefined): this | null | undefined
intersects(geometry: GeometryUnion | null | undefined): boolean
normalize(): Extent[]
offset(dx: number, dy: number, dz?: number): this
toJSON
inherited
toJSON(): any
union(extent: Extent): this

fromJSON

inheritedstatic Method
Signature
fromJSON (json: any): any
Inherited from: JSONSupportMixin

Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. The object passed into the input json parameter often comes from a response to a query operation in the REST API or a toJSON() method from another ArcGIS product. See the Using fromJSON() topic in the Guide for details and examples of when and how to use this function.

Parameters
ParameterTypeDescriptionRequired
json
any

A JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects.

Returns
any

Returns a new instance of this class.

centerAt

Method
Signature
centerAt (point: Point): this

Centers the extent to the specified Point. This method modifies the extent geometry in-place. You should clone() the extent object before calling this method where appropriate.

Parameters
ParameterTypeDescriptionRequired
point

The point to center the extent.

Returns
this

The new extent with point as the center.

clone

Method
Signature
clone (): Extent

Creates a deep clone of Extent object.

Returns
Extent

A new instance of a Extent object equal to the object used to call .clone().

contains

Method
Signature
contains (geometry: Point | Extent): boolean

Checks if the input geometry is contained within the extent.

Parameters
ParameterTypeDescriptionRequired
geometry

Input geometry to test if it is contained within the extent.

Returns
boolean

Returns true if the input geometry is contained within the extent.

equals

Method
Signature
equals (extent: Extent | null | undefined): boolean

Indicates if the input extent is equal to the testing extent.

Parameters
ParameterTypeDescriptionRequired
extent

Input extent.

Returns
boolean

Returns true if the input extent is equal to the extent that calls equals().

expand

Method
Signature
expand (factor: number): this

Expands the extent by the given factor. For example, a value of 1.5 will expand the extent to be 50 percent larger than the original extent. This method modifies the extent geometry in-place. You should clone() the extent object before calling this method where appropriate.

Parameters
ParameterTypeDescriptionRequired
factor

The multiplier value.

Returns
this

Returns the expanded extent.

intersection

Method
Signature
intersection (extent: Extent | null | undefined): this | null | undefined

Shrinks the original extent to the intersection with the input extent.

This method modifies the extent geometry in-place. You should clone() the extent object before calling this method where appropriate. If the original extent and the input extent have no intersection, the extent is not modified and null is returned.

Parameters
ParameterTypeDescriptionRequired
extent

The input extent to intersect.

Returns
this | null | undefined

The intersection of the input Extent with the original Extent or null.

intersects

Method
Signature
intersects (geometry: GeometryUnion | null | undefined): boolean

Tests to validate if the input geometry intersects the extent and returns a Boolean value.

Parameters
ParameterTypeDescriptionRequired
geometry

The geometry used to test the intersection. It can be a Point, Polyline, Polygon, Extent or Multipoint.

Returns
boolean

Returns true, if the input geometry intersects the extent.

normalize

Method
Signature
normalize (): Extent[]

Returns an array with either one Extent that's been shifted to within +/- 180 or two Extents if the original extent intersects the International Dateline.

This method modifies the extent geometry in-place. You should clone() the extent object before calling this method where appropriate.

Returns
Extent[]

The normalized Extent(s).

offset

Method
Signature
offset (dx: number, dy: number, dz?: number): this

Modifies the extent geometry in-place with X and Y offsets in map units. You should clone() the extent object before calling this method where appropriate.

Parameters
ParameterTypeDescriptionRequired
dx

The offset distance in map units for the X-coordinate.

dy

The offset distance in map units for the Y-coordinate.

dz

The offset distance in map units for the Z-coordinate.

Returns
this

The offset Extent.

toJSON

inherited Method
Signature
toJSON (): any
Inherited from: JSONSupportMixin

Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.

Returns
any

The ArcGIS portal JSON representation of an instance of this class.

union

Method
Signature
union (extent: Extent): this

Expands the original extent to include the extent of the input Extent. This method modifies the extent geometry in-place. You should clone() the extent object before calling this method where appropriate.

Parameters
ParameterTypeDescriptionRequired
extent

The input extent to union.

Returns
this

The union of the input Extent with the original Extent.