# Envelope

class Envelope : Geometry

A geometry that represents a rectangular shape. An Envelope is an axis-aligned box described by the coordinates of the lower left corner and the coordinates of the upper right corner. They are commonly used to represent the spatial extent covered by layers or other geometries, or to define an area of interest. They can be used as the geometry for a graphic and as an input for many spatial operations. Although they both represent a geographic area, an Envelope is distinct from a Polygon, and they cannot always be used interchangeably.

New instances of Envelope are defined by specifying a minimum and maximum x-coordinate and minimum and maximum y-coordinate, and a SpatialReference. Optionally, a minimum and maximum z-value can be specified to define the depth of the envelope.

## Constructors

fun Envelope(min: Point, max: Point)

Creates an envelope from any two points. The spatial reference of the points must be the same. The spatial reference of the result envelope comes from the points. If the values for min parameters are bigger than max parameters then they are re-ordered. The resulting envelope always has min less than or equal to max.

fun Envelope(    xMin: Double,     yMin: Double,     xMax: Double,     yMax: Double,     zMin: Double? = null,     zMax: Double? = null,     mMin: Double? = null,     mMax: Double? = null,     spatialReference: SpatialReference? = null)

Creates an Envelope based on the x, y, z and m values with a spatial reference.

fun Envelope(    center: Point,     width: Double,     height: Double,     depth: Double? = null)

Creates an envelope with a center point, width, height, and depth. The spatial reference of the resulting envelope comes from the center point.

object Companion

## Functions

open operator override fun equals(other: Any?): Boolean

fun equals(right: Geometry, tolerance: Double): Boolean

Check if two geometries are equal to within some tolerance. This function performs a lightweight comparison of two geometries, such as might be useful when writing test code. It uses the tolerance to compare each of x, y, and any other values the geometries possess (such as z or m) independently in the manner: abs(value1 - value2) <= tolerance. Returns true if the difference of each is within the tolerance and all other properties of the geometries are exactly equal (spatial reference, vertex count, etc.). A single tolerance is used even if the units for the horizontal coordinates and other values differ, e.g horizontal coordinates in degrees and vertical coordinates in meters. This function does not respect modular arithmetic of spatial references which wrap around, so longitudes of -180 and +180 degrees are considered to differ by 360 degrees. Returns false if an error occurs. For topological equality, use relational operators instead of this function. See GeometryEngine.equals(Geometry, Geometry).

open override fun hashCode(): Int
open override fun toJson(): String

Convert an object to JSON string.

## Properties

val center: Point
val depth: Double?

The depth (ZMax - ZMin) for the envelope. A 2D envelope has zero depth. The property will be NaN if the envelope is empty or if an error occurs. A value of Null indicates that the envelope does not have z-values.

val dimension: GeometryDimension

The number of dimensions for the geometry. Returns GeometryDimension.Unknown if an error occurs.

val extent: Envelope
val hasCurves: Boolean

True if this geometry contains curve segments; false otherwise. The ArcGIS Platform supports polygon and polyline geometries that contain curve segments (where Segment.getIsCurve() is true, sometimes known as true curves or nonlinear segments). Curves may be present in certain types of data - for example Mobile Map Packages (MMPK) or geometry JSON. When connecting to ArcGIS feature services that support curves[ArcGISFeatureServiceInfo.getSupportsTrueCurve()], ArcGIS Maps API retrieves densified versions of curve feature geometries by default.

val hasM: Boolean

A value indicating if the geometry has M. If an error occurs false is returned. M is a vertex value that is stored with the geometry.

val hasZ: Boolean

A value indicating if the geometry has Z. If an error occurs false is returned. Z typically represent elevations or heights.

val height: Double

The height for the envelope. Returns NAN if an error occurs.

val isEmpty: Boolean

Check if a geometry is empty or not. Only check the geometry to see if it is empty. Does not check the spatial reference. Returns true if an error occurs.

val mMax: Double?

The m maximum value for the envelope. The property will be NaN if an error occurs. A value of Null indicates that the envelope does not have a m maximum value.

val mMin: Double?

The m minimum value for the envelope. The property will be NaN if an error occurs. A value of Null indicates that the geometry does not have a m minimum value.

val spatialReference: SpatialReference?
open override val unknownJson: Map<String, Any>

Unknown data from the source JSON. Unknown JSON is a dictionary of values that was in the source JSON but was unparsed by this API.

open override val unsupportedJson: Map<String, Any>

Unsupported data from the source JSON. Unsupported JSON is a dictionary of values that are supported by web maps, but not exposed through this API.

val width: Double

The width for the envelope. Returns NAN if an error occurs.

val xMax: Double

The x maximum value for the envelope. Returns NAN if an error occurs.

val xMin: Double

The x minimum value for the envelope. Returns NAN if an error occurs.

val yMax: Double

The y maximum value for the envelope. Returns NAN if an error occurs.