# Geometry functions

The following functions allow you to create and evaluate geometry objects. Please note that if your input has more than one geometry, they must have the same spatial reference.

## Angle

This function has 2 signatures:

#### Angle(pointA, pointB) -> Number

**Function bundle**: Geometry

Returns the arithmetic angle of a line between two points in degrees (0 - 360). The angle is measured in a counter-clockwise direction relative to east. For example, an angle of 90 degrees points due north.

Only the x-y plane is considered for the measurement. Any z-coordinates are ignored. Point features can be used instead of any or both Point geometries. *If the points are identical, then an angle of 0 degrees is returned.*

**Parameters**

**pointA**: Point | Feature - The first Point or Feature used to calculate the angle.**pointB**: Point | Feature - The second Point or Feature used to calculate the angle.

**Return value**: Number

##### Example

Returns the angle from a Point to a Feature, in degrees

#### Angle(pointA, pointB, pointC) -> Number

**Function bundle**: Geometry

Returns the arithmetic angle of a line between three points in degrees (0 - 360). The angle is measured around `point`

in a counter-clockwise direction, from `point`

to `point`

.

Only the x-y plane is considered for the measurement. Any z-coordinates are ignored. Point features can be used instead of either or all Point geometries. *If the points are identical, then an angle of 0 or 180 degrees is returned (depending internal arithmetic).*

**Parameters**

**pointA**: Point | Feature - The first Point or Feature used to calculate the angle.**pointB**: Point | Feature - The second Point or Feature used to calculate the angle.**pointC**: Point | Feature - The third Point or Feature used to calculate the angle.

**Return value**: Number

##### Example

Returns the angle between two points around the feature, in degrees

## Area

#### Area(polygon, unit?) -> Number

**Function bundle**: Geometry

Returns the area of the input geometry or Feature in the given units. This is a planar measurement using Cartesian mathematics.

*Feature geometries in the visualization and labeling profiles are generalized according to the view's scale resolution to improve drawing performance. Therefore, using a feature's geometry (i.e. $feature) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.*

**Parameters**

**polygon**: Polygon | Feature | Array<Point> - The Polygon or Feature for which to calculate the planar area.**unit**(*Optional*): Text | Number - Measurement unit of the return value.

Possible values:`acres`

|`square-feet`

|`hectares`

|`square-kilometers`

|`square-miles`

|`square-nautical-miles`

|`square-meters`

|`square-yards`

**Return value**: Number

##### Example

Returns the area of the feature in square meters

## AreaGeodetic

#### AreaGeodetic(polygon, unit?) -> Number

**Function bundle**: Geometry

Returns the geodetic area of the input geometry or Feature in the given units. This is more reliable measurement of area than `Area()`

because it takes into account the Earth's curvature. Support is limited to geometries with a Web Mercator (wkid 3857) or a WGS 84 (wkid 4326) spatial reference.

*Feature geometries in the visualization and labeling profiles are generalized according to the view's scale resolution to improve drawing performance. Therefore, using a feature's geometry (i.e. $feature) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.*

**Parameters**

**polygon**: Polygon | Feature | Array<Point> - The Polygon or Feature for which to calculate the geodetic area.**unit**(*Optional*): Text | Number - Measurement unit of the return value.

Possible values:`acres`

|`square-feet`

|`hectares`

|`square-kilometers`

|`square-miles`

|`square-nautical-miles`

|`square-meters`

|`square-yards`

**Return value**: Number

##### Example

Returns the geodetic area of the feature in square meters

## Bearing

This function has 2 signatures:

#### Bearing(pointA, pointB) -> Number

**Function bundle**: Geometry

Returns the geographic angle of a line between two points in degrees (0 - 360). The bearing is measured in a clockwise direction relative to north. For example, a bearing of 225 degrees represents a southwest orientation.

Only the x-y plane is considered for the measurement. Any z-coordinates are ignored. Point features can be used instead of either or both Point geometries. *If the points are identical, then an angle of 0 is returned.*

**Parameters**

**pointA**: Point | Feature - The first point used to calculate the bearing.**pointB**: Point | Feature - The second point used to calculate the bearing.

**Return value**: Number

##### Example

Returns the bearing from a point to the feature, in degrees

#### Bearing(pointA, pointB, pointC) -> Number

**Function bundle**: Geometry

Returns the geographic angle of a line between three points in degrees (0 - 360). The bearing is measured around `point`

in a clockwise direction, from `point`

to `point`

.

Only the x-y plane is considered for the measurement. Any z-coordinates are ignored. Point features can be used instead of any or all Point geometries. *If the points are identical, then an angle of 0 or 180 degrees is returned (depending internal arithmetic).*

**Parameters**

**pointA**: Point | Feature - The first point used to calculate the bearing.**pointB**: Point | Feature - The second point used to calculate the bearing.**pointC**: Point | Feature - The third point used to calculate the bearing.

**Return value**: Number

##### Example

Returns the bearing between two points around the feature, in degrees

## Buffer

#### Buffer(inputGeometry, distance, unit?) -> Polygon

**Function bundle**: Geometry

Returns the planar (or Euclidean) buffer at a specified distance around the input geometry. This is a planar measurement using Cartesian mathematics.

*Feature geometries in the visualization and labeling profiles are generalized according to the view's scale resolution to improve drawing performance. Therefore, using a feature's geometry (i.e. $feature) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.*

**Parameters**

**inputGeometry**: Geometry | Feature - The geometry to buffer.**distance**: Number - The distance to buffer from the geometry.**unit**(*Optional*): Text | Number - Measurement unit of the buffer`distance`

. For the visualization, labeling, and popup profiles, the default unit is the map's spatial reference. In other profiles, like field calculation, the default is based on the spatial reference of the data.

Possible values:`feet`

|`kilometers`

|`miles`

|`nautical-miles`

|`meters`

|`yards`

**Return value**: Polygon

##### Example

Returns a polygon representing a 1/2-mile buffer around the input geometry

## BufferGeodetic

#### BufferGeodetic(inputGeometry, distance, unit?) -> Polygon

**Function bundle**: Geometry

Returns the geodetic buffer at a specified distance around the input geometry. This is a geodesic measurement, which calculates distances on an ellipsoid. Support is limited to geometries with a Web Mercator (wkid 3857) or a WGS 84 (wkid 4326) spatial reference.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**inputGeometry**: Geometry | Feature - The geometry to buffer.**distance**: Number - The distance to buffer from the geometry.**unit**(*Optional*): Text | Number - Measurement unit of the buffer`distance`

. For the visualization, labeling, and popup profiles, the default unit is the map's spatial reference. In other profiles, like field calculation, the default is based on the spatial reference of the data.

Possible values:`feet`

|`kilometers`

|`miles`

|`nautical-miles`

|`meters`

|`yards`

**Return value**: Polygon

##### Example

Returns a polygon representing a 1/2-mile buffer around the input geometry

## Centroid

#### Centroid(polygon) -> Point

**Function bundle**: Geometry

Returns the centroid of the input geometry.

**Parameter**

**Return value**: Point

##### Examples

Returns the centroid of the given polygon

Returns the centroid of the given polygon ring

## Clip

#### Clip(inputGeometry, envelope) -> Geometry

**Function bundle**: Geometry

Calculates the clipped geometry from a target geometry by an envelope.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**inputGeometry**: Geometry | Feature - The geometry to be clipped.**envelope**: Extent - The envelope used to clip the`geometry`

.

**Return value**: Geometry

##### Example

Returns the area of the clipped geometry

## Contains

This function has 2 signatures:

- Contains(containerGeometry, insideGeometry) -> Boolean
- Contains(containerGeometry, insideFeatures) -> FeatureSet

#### Contains(containerGeometry, insideGeometry) -> Boolean

**Function bundle**: Geometry

Indicates if one geometry contains another geometry. In the graphic below, the red highlight indicates the scenarios where the function will return `true`

.

**Be aware that using $feature as input to this function will yield results only as precise as the view's scale resolution. Therefore values returned from expressions using this function may change after zooming between scales.**

**Parameters**

**containerGeometry**: Geometry | Feature - The geometry that is tested for the 'contains' relationship to`inside`

. Think of this geometry as the potential 'container' of theGeometry `inside`

.Geometry **insideGeometry**: Geometry | Feature - The geometry that is tested for the 'within' relationship to the`container`

.Geometry

**Return value**: Boolean

##### Example

Returns true if the feature is contained within the given polygon

#### Contains(containerGeometry, insideFeatures) -> FeatureSet

**Function bundle**: Geometry

Returns features from a FeatureSet that are contained within the input geometry. In the graphic below, the red highlight illustrates the spatial relationships where the function will return features.

**Be aware that using $feature as input to this function will yield results only as precise as the view's scale resolution. Therefore values returned from expressions using this function may change after zooming between scales.**

**Parameters**

**containerGeometry**: Geometry | Feature - The geometry that is tested for the 'contains' relationship to`inside`

. Think of this geometry as the potential 'container' of theFeatures `inside`

.Features **insideFeatures**: FeatureSet - The FeatureSet that is tested for the 'within' relationship to the`container`

.Geometry

**Return value**: FeatureSet

##### Example

Returns the number of features that are within the given polygon

## ConvertDirection

#### ConvertDirection(input, inputSpec, outputSpec) -> Array<Number | Text> | Number | Text

**Function bundle**: Geometry

Angles can have several interpretations and can be represented as a number, a text, or a well formed array. This function takes one input representation and converts it to another.

The input value is described by a dictionary that specified the type of angle and the type of direction. Examples:

input | angle type | direction type |
---|---|---|

12.34 | dms, degrees, radians, gradians | north, south, polar |

12.3456 | dms, degrees, radians, gradians | north, south, polar |

[12,34,56] | dms | north, south, polar |

['N',12.34,'W'] | dms, degrees, radians, gradians | quadrant |

['N',12,34,56,'W'] | dms | quadrant |

'12.34' | dms, degrees, radians, gradians | north, south, polar |

'12 34 56' | dms | north, south, polar |

'N 12.34 W' | dms, degrees, radians, gradians | quadrant |

'N 12 34 56 W' | dms | quadrant |

If the `angle`

and `direction`

are not appropriate for the input, then the conversion will fail.

The desired output value is as well described by a dictionary that specidies output type, angle type, direction type, and an optional format for text ouput.

If the output type is `value`

:

- an array will be returned for angle type
`dms`

or for direction type`quadrant`

- a number will be returned for all the other cases

If the output type is `text`

, then default padding and delimeters will be used unless the optional`format`

property is provided.

`format`

controls order, spacing, padding, and delimeters in the output text.

Strings of format specifier characters before a decimal point indicate minimum padding (e.g. `DDD -> 000`

).

Strings of format characters after a decimal point indicate precision (e.g. `D.DD -> 0.00`

).

Supported `format`

characters:

Code | Meaning |
---|---|

`D` | Decimal Degrees |

`R` | Radians |

`G` | Gradians |

`d` | DMS Degrees |

`m` | DMS Minutes |

`s` | DMS Seconds |

`P` | Long Meridian (e.g. `North` vs. `South` ) |

`p` | Short Meridian (e.g. `N` vs. `S` ) |

`B` | Long direction (e.g. `East` vs. `West` ) |

`b` | Short direction (e.g. `E` vs. `W` ) |

`[ ]` | Escape characters |

For `dms`

formatting, if the `s`

is not used then `m`

will round to the nearest minute. Similarly, if `m`

is not used then `d`

will round.

**Parameters**

**input**: Array<Number | Text> | Number | Text - A raw representation of the bearing. The type of`input`

and the values of the`input`

dictate how the input is parsed.Spec **inputSpec**: Dictionary - Contains information about how to interpret input.**outputSpec**: Dictionary - Contains information about how to format the output.**outputType**: Text - Controls output type.

Supported Values:`value`

,`text`

**angleType**: Text - Describes the output angle unit. Supported Values:`DEGREES`

,`DMS`

,`RADIANS`

,`GONS`

,`GRADIANS`

**directionType**: Text - Describes the output bearing's meridian and direction. Supported Values:`NORTH`

,`SOUTH`

,`POLAR`

,`QUADRANT`

**format**(*Optional*): Text - Controls text formatting. Only applicable if`output`

isType `text`

.

**Return value**: Array<Number | Text> | Number | Text

##### Examples

Examples where the `output`

is `value`

.

Examples where `output`

is `text`

.

## ConvexHull

#### ConvexHull(inputGeometry) -> Geometry

**Function bundle**: Geometry

Calculates the convex hull of a geometry. A convex hull is the smallest convex polygon that encloses a geometry. The hull is typically a polygon but can also be a polyline or a point in degenerate cases.

**Be aware that using $feature as input to this function will yield results only as precise as the view's scale resolution. Therefore values returned from expressions using this function may change after zooming between scales.**

**Parameter**

**Return value**: Geometry

##### Examples

Returns the number of vertices in the convex hull geometry of the current feature's geometry

Returns the convex hull of a geometry which has a concave region (which the convex hull will ignore)

## Crosses

#### Crosses(geometry1, geometry2) -> Boolean

**Function bundle**: Geometry

Indicates if one geometry crosses another geometry. In the graphic below, the red highlight indicates the scenarios where the function will return `true`

.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**geometry1**: Geometry | Feature - The geometry to cross.**geometry2**: Geometry | Feature - The geometry being crossed.

**Return value**: Boolean

##### Example

Returns true if the feature crosses the given polygon

## Cut

#### Cut(polylineOrPolygon, cutter) -> Array<Geometry>

**Function bundle**: Geometry

Splits the input Polyline or Polygon where it crosses a cutting Polyline. For Polylines, all resulting left cuts are grouped together in the first Geometry. Right cuts and coincident cuts are grouped in the second Geometry. Each undefined cut, along with any uncut parts, are output as separate Polylines.

For Polygons, all resulting left cuts are grouped in the first Polygon, all right cuts are grouped in the second Polygon, and each undefined cut, along with any left-over parts after cutting, are output as a separate Polygon. If no cuts are returned then the array will be empty. An undefined cut will only be produced if a left cut or right cut was produced and there was a part left over after cutting, or a cut is bounded to the left and right of the cutter.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**polylineOrPolygon**: Polyline | Polygon | Feature - The geometry to cut.**cutter**: Polyline | Feature - The Polyline used to cut the`geometry`

.

##### Example

Cuts the feature's geometry with the given polyline

## Densify

#### Densify(inputGeometry, maxSegmentLength, unit?) -> Geometry

**Function bundle**: Geometry

Densifies geometries by inserting vertices to create segments no longer than the specified interval.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**inputGeometry**: Geometry | Feature - The input geometry to be densified.**maxSegmentLength**: Number - The maximum segment length allowed. Must be a positive value.**unit**(*Optional*): Text | Number - Measurement unit for maxSegmentLength. Defaults to the units of the input geometry. For the visualization, labeling, and popup profiles, the default unit is the map's spatial reference. In other profiles, like field calculation, the default is based on the spatial reference of the data.

Possible values:`feet`

|`kilometers`

|`miles`

|`nautical-miles`

|`meters`

|`yards`

**Return value**: Geometry

##### Example

Returns the densified geometry with a maximum segment length of 10 m

## DensifyGeodetic

#### DensifyGeodetic(inputGeometry, maxSegmentLength, unit?) -> Geometry

**Function bundle**: Geometry

Geodesically densifies geometries by inserting vertices to create segments no longer than the specified interval.

`$feature`

as input to this function will yield results only as precise as the view's scale resolution. Therefore values returned from expressions using this function may change after zooming between scales.

**Parameters**

**inputGeometry**: Geometry | Feature - The input geometry to be densified.**maxSegmentLength**: Number - The maximum segment length allowed. Must be a positive value.**unit**(*Optional*): Text | Number - Measurement unit for maxSegmentLength. Defaults to the units of the input geometry. For the visualization, labeling, and popup profiles, the default unit is the map's spatial reference. In other profiles, like field calculation, the default is based on the spatial reference of the data.

Possible values:`feet`

|`kilometers`

|`miles`

|`nautical-miles`

|`meters`

|`yards`

**Return value**: Geometry

##### Example

Returns the densified geometry with a maximum segment length of 10000

## Difference

#### Difference(inputGeometry, subtractor) -> Geometry

**Function bundle**: Geometry

Performs the topological difference operation for the two geometries. The resultant geometry comes from `input`

, not the `subtractor`

. The dimension of `subtractor`

has to be equal to or greater than that of `input`

.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**inputGeometry**: Geometry | Feature - The input geometry from which to subtract.**subtractor**: Geometry | Feature - The geometry to subtract from`geometry`

.

**Return value**: Geometry

##### Example

Subtracts the given polygon area from the feature.

## Disjoint

#### Disjoint(geometry1, geometry2) -> Boolean

**Function bundle**: Geometry

Indicates if one geometry is disjoint (doesn't intersect in any way) with another geometry. In the table below, the red highlight indicates that the function would return `true`

with the specified geometries.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**geometry1**: Geometry | Feature - The base geometry that is tested for the 'disjoint' relationship to`geometry2`

.**geometry2**: Geometry | Feature - The comparison geometry that is tested for the 'disjoint' relationship to`geometry1`

.

**Return value**: Boolean

##### Example

Returns true if the geometries don't intersect

## Distance

#### Distance(geometry1, geometry2, unit?) -> Number

**Function bundle**: Geometry

Returns the planar distance between two geometries in the given units. This is a planar measurement using Cartesian mathematics.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**geometry1**: Geometry | Feature | Array<Point> - The geometry used to measure the distance from`geometry2`

.**geometry2**: Geometry | Feature | Array<Point> - The geometry used to measure the distance from`geometry1`

.**unit**(*Optional*): Text | Number - Measurement unit of the return value. For the visualization, labeling, and popup profiles, the default unit is the map's spatial reference. In other profiles, like field calculation, the default is based on the spatial reference of the data.

Possible values:`feet`

|`kilometers`

|`miles`

|`nautical-miles`

|`meters`

|`yards`

**Return value**: Number

##### Example

Returns the distance between two geometries in meters

## DistanceGeodetic

#### DistanceGeodetic(point1, point2, units?) -> Number

**Function bundle**: Geometry

Calculates the shortest distance between two points along a great circle. Applies only to points with a Geographic Coordinate System (GCS) or the Web Mercator spatial reference. If the input points have a Projected Coordinate System (other than Web Mercator), you should use the distance method.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**point1**: Point | Feature - The point used to measure the distance from`point2`

. This point must have a GCS or Web Mercator spatial reference.**point2**: Point | Feature - The point used to measure the distance from`point1`

. This point must have a GCS or Web Mercator spatial reference.**units**(*Optional*): Text | Number - Measurement unit of the return value. For the visualization, labeling, and popup profiles, the default unit is the map's spatial reference. In other profiles, like field calculation, the default is based on the spatial reference of the data.

Possible values:`feet`

|`kilometers`

|`miles`

|`nautical-miles`

|`meters`

|`yards`

**Return value**: Number

##### Example

Returns the distance from a bus in a stream layer to the central station in kilometers

## EnvelopeIntersects

#### EnvelopeIntersects(geometry1, geometry2) -> Boolean

**Function bundle**: Geometry

Indicates if the envelope (or extent) of one geometry intersects the envelope of another geometry. In the graphic below, the red highlight indicates the scenarios where the function will return `true`

.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**geometry1**: Geometry | Feature - The geometry that is tested for the intersects relationship to the other geometry.**geometry2**: Geometry | Feature - The geometry being intersected.

**Return value**: Boolean

##### Example

Returns true if the geometries intersect

## Equals

#### Equals(geometry1, geometry2) -> Boolean

**Function bundle**: Geometry

Indicates if two geometries are equal, or geographically equivalent given the spatial reference and tolerance of the data. The two input geometries don't have to be clones to be considered equal.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**geometry1**: Geometry | Feature - The first input geometry.**geometry2**: Geometry | Feature - The second input geometry.

**Return value**: Boolean

##### Example

Returns true if the geometries are equal

## Extent

#### Extent(inputGeometry) -> Extent

**Function bundle**: Geometry

Constructs an Extent object from serialized JSON text or a dictionary. The JSON schema must follow the ArcGIS REST API format for Envelope geometries. This function may also return the extent of an input Polygon, Point, Polyline or Multipoint.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameter**

**inputGeometry**: Dictionary | Geometry | Feature - The JSON or Geometry from which to construct the extent geometry object.

**Return value**: Extent

##### Examples

## Generalize

#### Generalize(inputGeometry, maxDeviation, removeDegenerateParts?, maxDeviationUnit?) -> Geometry

**Function bundle**: Geometry

Reduces the number of vertices in the input geometry based on a given deviation value. Point and Multipoint geometries are left unchanged. Envelopes are converted to Polygons and then generalized.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**inputGeometry**: Geometry | Feature - The input geometry to be generalized.**maxDeviation**: Number - The maximum allowed deviation from the generalized geometry to the original geometry.**removeDegenerateParts**(*Optional*): Boolean - When`true`

the degenerate parts of the geometry will be removed from the output (may be undesired for drawing).**maxDeviationUnit**(*Optional*): Text | Number - Measurement unit for maxDeviation. Defaults to the units of the input geometry.

Possible values:`feet`

|`kilometers`

|`miles`

|`nautical-miles`

|`meters`

|`yards`

**Return value**: Geometry

##### Example

Returns a generalized version of the input geometry

## Geometry

#### Geometry(inputFeature) -> Geometry

**Function bundle**: Geometry

Constructs a Geometry object from serialized JSON text or a dictionary. The JSON schema must follow the ArcGIS REST API format for geometries. This function may also return the Geometry of an input feature.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameter**

**inputFeature**: Feature | Dictionary - The Feature or JSON from which to construct the geometry object.

**Return value**: Geometry

##### Examples

Returns the geometry of the feature

Constructs a point geometry. This can be done with any geometry type.

## Intersection

#### Intersection(geometry1, geometry2) -> Geometry

**Function bundle**: Geometry

Constructs the set-theoretic intersection between two geometries and returns a new geometry.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**geometry1**: Geometry | Feature - The geometry to intersect with`geometry2`

.**geometry2**: Geometry | Feature - The geometry to intersect with`geometry1`

.

**Return value**: Geometry

##### Example

Returns the area common to both polygons

## Intersects

#### Intersects(geometry1, geometry2) -> Boolean

**Function bundle**: Geometry

Indicates if one geometry intersects another geometry. In the graphic below, the red highlight indicates the scenarios where the function will return `true`

.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**geometry1**: Geometry | Feature - The geometry that is tested for the intersects relationship to`geometry2`

.**geometry2**: Geometry | Feature - The geometry being intersected.

**Return value**: Boolean

##### Example

Returns true if the geometries intersect

## IsSelfIntersecting

#### IsSelfIntersecting(inputGeometry) -> Boolean

**Function bundle**: Geometry

Indicates whether the input geometry has rings, paths, or points that intersect or cross other parts of the geometry. For example, a single polyline feature whose paths intersect each other or a polygon with rings that self intersect would return `true`

.

**Parameter**

**inputGeometry**: Geometry | Feature - The polygon, polyline, or multipoint geometry to test for the self intersection.

**Return value**: Boolean

##### Example

Returns true if the polyline's paths intersect each other

## IsSimple

#### IsSimple(inputGeometry) -> Boolean

**Function bundle**: Geometry

Indicates if the given geometry is topologically simple.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameter**

**Return value**: Boolean

##### Example

Returns true if the geometry is topologically simple

## Length

#### Length(inputGeometry, unit?) -> Number

**Function bundle**: Geometry

Returns the length of the input geometry or Feature in the given units. This is a planar measurement using Cartesian mathematics.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**inputGeometry**: Geometry | Feature | Array<Point> - The geometry or geometries for which to calculate the planar length.**unit**(*Optional*): Text | Number - Measurement unit of the return value. For the visualization, labeling, and popup profiles, the default unit is the map's spatial reference. In other profiles, like field calculation, the default is based on the spatial reference of the data.

Possible values:`feet`

|`kilometers`

|`miles`

|`nautical-miles`

|`meters`

|`yards`

**Return value**: Number

##### Example

Returns the planar length of the feature in kilometers

## Length3D

#### Length3D(inputGeometry, unit?) -> Number

**Function bundle**: Geometry

**Profiles**: Attribute Rules | Popups | Field Calculation | Form Calculation | Tasks

Returns the planar (i.e. Cartesian) length of the input geometry or Feature taking height or Z information into account. The geometry provided to this function must be assigned a projected coordinate system. If the spatial reference does not provide a value for Z units, then the result will be returned in meters. Keep in mind that not all clients (such as the 3.x series of the ArcGIS API for JavaScript) support requesting Z values even when the data contains Z information.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**inputGeometry**: Geometry | Feature | Array<Point> - The geometry or Feature for which to calculate the planar length in 3D space.**unit**(*Optional*): Text | Number - Measurement unit of the return value. For the visualization, labeling, and popup profiles, the default unit is the map's spatial reference. In other profiles, like field calculation, the default is based on the spatial reference of the data.

Possible values:`feet`

|`kilometers`

|`miles`

|`nautical-miles`

|`meters`

|`yards`

**Return value**: Number

##### Examples

Returns the 3D planar length of the feature in the unit of the spatial reference of the context executing the expression.

Returns the 3D planar length of the feature in feet.

## LengthGeodetic

#### LengthGeodetic(inputGeometry, unit?) -> Number

**Function bundle**: Geometry

Returns the geodetic length of the input geometry or Feature in the given units. This is more reliable measurement of length than Length() because it takes into account the Earth's curvature. Support is limited to geometries with a Web Mercator (wkid 3857) or a WGS 84 (wkid 4326) spatial reference.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**inputGeometry**: Geometry | Feature | Array<Point> - The geometry for which to calculate the geodetic length.**unit**(*Optional*): Text | Number - Measurement unit of the return value. For the visualization, labeling, and popup profiles, the default unit is the map's spatial reference. In other profiles, like field calculation, the default is based on the spatial reference of the data.

Possible values:`feet`

|`kilometers`

|`miles`

|`nautical-miles`

|`meters`

|`yards`

**Return value**: Number

##### Example

Returns the geodetic length of the feature in kilometers

## MultiPartToSinglePart

#### MultiPartToSinglePart(inputGeometry) -> Array<Geometry>

**Function bundle**: Geometry

Converts a multi-part geometry into separate geometries.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameter**

##### Example

Returns an array of single-part geometries from a multi-part geometry

## Multipoint

#### Multipoint(definition) -> Multipoint

**Function bundle**: Geometry

Constructs a Multipoint object from serialized JSON text or a dictionary. The JSON schema must follow the ArcGIS REST API format for multipoint geometries

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameter**

**definition**: Dictionary - The JSON from which to construct the multipoint geometry object.

**Return value**: Multipoint

##### Example

## Offset

#### Offset(inputGeometry, offsetDistance, offsetUnit?, joinType?, bevelRatio?, flattenError?) -> Geometry

**Function bundle**: Geometry

Creates a geometry that is a constant planar distance from an input geometry. It is similar to buffering, but produces a one-sided result.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**inputGeometry**: Geometry | Feature - The geometry to offset. Point geometries are not supported.**offsetDistance**: Number - The planar distance to offset from the input geometry. If`offset`

, then the offset geometry is constructed to the right of the input geometry, ifDistance > 0 `offset`

, then there is no change in the geometries, otherwise it is constructed to the left. The direction of the paths or rings of the input geometry determines which side of the geometry is considered right, and which side is considered left. For a simple polygon, the orientation of outer rings is clockwise and for inner rings it is counter clockwise. So the right side of a simple polygon is always its inside.Distance = 0 **offsetUnit**(*Optional*): Text | Number - Measurement unit for`offset`

. Defaults to the units of the input geometry.Distance

Possible values:`feet`

|`kilometers`

|`miles`

|`nautical-miles`

|`meters`

|`yards`

**joinType**(*Optional*): Text - The join type. Possible values are`round`

,`bevel`

,`miter`

, or`square`

.**bevelRatio**(*Optional*): Number - Applicable when`join`

;Type = 'miter' `bevel`

is multiplied by the offset distance and the result determines how far a mitered offset intersection can be located before it is beveled.Ratio **flattenError**(*Optional*): Number - Applicable when`join`

;Type = 'round' `flatten`

determines the maximum distance of the resulting segments compared to the true circular arc. The algorithm never produces more than around 180 vertices for each round join.Error

**Return value**: Geometry

##### Example

Returns the offset geometry

## Overlaps

#### Overlaps(geometry1, geometry2) -> Boolean

**Function bundle**: Geometry

Indicates if one geometry overlaps another geometry. In the graphic below, the red highlight indicates the scenarios where the function will return `true`

.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**geometry1**: Geometry | Feature - The base geometry that is tested for the 'overlaps' relationship with`geometry2`

.**geometry2**: Geometry | Feature - The comparison geometry that is tested for the 'overlaps' relationship with`geometry1`

.

**Return value**: Boolean

##### Example

Returns true if the geometries overlap

## Point

#### Point(definition) -> Point

**Function bundle**: Geometry

Constructs a Point object from serialized JSON text or a dictionary. The JSON schema must follow the ArcGIS REST API format for Point geometries.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameter**

**definition**: Dictionary - The JSON from which to construct the point geometry object.

**Return value**: Point

##### Example

## Polygon

#### Polygon(definition) -> Polygon

**Function bundle**: Geometry

Constructs a Polygon object from serialized JSON text or a dictionary. The JSON schema must follow the ArcGIS REST API format for Polygon geometries.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameter**

**definition**: Dictionary - The JSON from which to construct the polygon geometry object.

**Return value**: Polygon

##### Example

## Polyline

#### Polyline(definition) -> Polyline

**Function bundle**: Geometry

Constructs a Polyline object from serialized JSON text or a dictionary. The JSON schema must follow the ArcGIS REST API format for Polyline geometries.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameter**

**definition**: Dictionary - The JSON from which to construct the polyline geometry object.

**Return value**: Polyline

##### Example

## Relate

#### Relate(geometry1, geometry2, relation) -> Boolean

**Function bundle**: Geometry

Indicates if the given DE-9IM relation is `true`

for the two geometries.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**geometry1**: Geometry | Feature - The first geometry for the relation.**geometry2**: Geometry | Feature - The second geometry for the relation.**relation**: Text - The Dimensionally Extended 9 Intersection Model (DE-9IM) matrix relation (encoded as a text value) to test against the relationship of the two geometries. This text contains the test result of each intersection represented in the DE-9IM matrix. Each result is one character of the text and may be represented as either a number (maximum dimension returned: 0,1,2), a Boolean value (T or F), or a mask character (for ignoring results: '*').

Example: Each of the following DE-9IM text codes are valid for testing whether a polygon geometry completely contains a line geometry: TTTFFTFFT (Boolean), 'T******FF*' (ignore irrelevant intersections), or '102FF*FF*' (dimension form). Each returns the same result.

**Return value**: Boolean

##### Example

Returns true if the relation of the input geometries matches

## RingIsClockwise

#### RingIsClockwise(points) -> Boolean

**Function bundle**: Geometry

Indicates whether the points in a polygon ring are ordered in a clockwise direction.

**Parameter**

**Return value**: Boolean

##### Example

## Rotate

#### Rotate(inputGeometry, angle, rotationOrigin?) -> Geometry

**Function bundle**: Geometry

Rotates a geometry counterclockwise by the specified number of degrees. Rotation is around the centroid, or a given rotation point.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**inputGeometry**: Geometry | Feature - The geometry to rotate.**angle**: Number - The rotation angle in degrees.**rotationOrigin**(*Optional*): Point - Point to rotate the geometry around. Defaults to the centroid of the geometry.

**Return value**: Geometry

##### Example

Returns the input feature rotated about the centroid by 90 degrees

## SetGeometry

#### SetGeometry(inputFeature, inputGeometry) -> Null

**Function bundle**: Geometry

Sets or replaces a geometry on a user-defined Feature. Note that features referenced as global variables are immutable; their geometries cannot be changed.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**inputFeature**: Feature - A feature whose geometry will be updated.**inputGeometry**: Geometry - The geometry to set on the input feature.

**Return value**: Null

##### Example

Sets a new geometry on the feature

## Simplify

#### Simplify(inputGeometry) -> Geometry

**Function bundle**: Geometry

Performs the simplify operation on the geometry. This alters the given geometry to make it topologically legal.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameter**

**Return value**: Geometry

##### Example

Returns the simplified geometry of the feature

## SymmetricDifference

#### SymmetricDifference(leftGeometry, rightGeometry) -> Geometry

**Function bundle**: Geometry

Performs the Symmetric difference operation on the two geometries. The symmetric difference includes the parts of both geometries that are not common with each other.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**leftGeometry**: Geometry | Feature - The geometry instance to compare to`right`

in the XOR operation.Geometry **rightGeometry**: Geometry | Feature - The geometry instance to compare to`left`

in the XOR operation.Geometry

**Return value**: Geometry

##### Example

Returns a polygon representing areas where both inputs do not overlap

## Touches

#### Touches(geometry1, geometry2) -> Boolean

**Function bundle**: Geometry

Indicates if one geometry touches another geometry. In the graphic below, the red highlight indicates the scenarios where the function will return `true`

.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**geometry1**: Geometry | Feature - The geometry to test the 'touches' relationship with`geometry2`

.**geometry2**: Geometry | Feature - The geometry to test the 'touches' relationship with`geometry1`

.

**Return value**: Boolean

##### Example

Returns true if the geometries touch

## Union

This function has 2 signatures:

#### Union(geometries) -> Geometry

**Function bundle**: Geometry

Constructs the set-theoretic union of the geometries or features in an input array and returns a single Geometry. All inputs must have the same geometry type and share the same spatial reference.

`$feature`

as input to this function will yield results only as precise as the view's scale resolution. Therefore values returned from expressions using this function may change after zooming between scales.

**Parameter**

**geometries**: Array<Geometry> | Array<Feature> - An array of geometries or an array of features to union into a single geometry. This can be any number of geometries.

**Return value**: Geometry

##### Example

#### Union(geometry1, [geometry2, ..., geometryN]?) -> Geometry

**Function bundle**: Geometry

Constructs the set-theoretic union of a list of geometries and returns a single Geometry. All inputs must have the same geometry type and share the same spatial reference.

`$feature`

as input to this function will yield results only as precise as the view's scale resolution. Therefore values returned from expressions using this function may change after zooming between scales.

**Parameters**

**geometry1**: Geometry | Feature - A geometry to union into a single geometry with the other geometries.**[geometry2, ..., geometryN]**(*Optional*): Geometry | Feature - An ongoing list of geometries or features to union into a single geometry. This can be any number of geometries.

**Return value**: Geometry

##### Example

## Within

#### Within(innerGeometry, outerGeometry) -> Boolean

**Function bundle**: Geometry

Indicates if one geometry is within another geometry. In the graphic below, the red highlight indicates the scenarios where the function will return `true`

.

`$feature`

) as input to any geometry function in these contexts will return different results at each scale level. Other profiles, such as popup, provide the full resolution geometry.

**Parameters**

**innerGeometry**: Geometry | Feature - The base geometry that is tested for the 'within' relationship to`outer`

.Geometry **outerGeometry**: Geometry | Feature - The comparison geometry that is tested for the 'contains' relationship to`inner`

.Geometry

**Return value**: Boolean

##### Example

Returns true if the feature is within the given polygon