Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/workers
Object: esri/geometry/geometryEngineAsync

require(["esri/geometry/geometryEngineAsync"], function(geometryEngineAsync) { /* code goes here */ });

Description

(Added at v3.13)
A client-side asynchronous geometry engine. The difference between the geometryEngineAsync and geometryEngine modules is the async functions return a Promise that are resolved with the same argument as is returned by the sync functions. See the union method for a code sample.

Known limitation: the geometryEngineAsync module requires a browser with Web Worker support. This can be tested for by inspecting the window.Worker property in the browser. In addition to this, it is only supported using AMD-style coding syntax.

Samples

Search for samples that use this class.

Methods

NameReturn typeSummary
buffer(geometry, distance, unit, unionResults?)PromiseCreates planar (or Euclidean) buffer polygons at a specified distance around the input geometries.
clip(geometry, envelope)PromiseCalculates the clipped geometry from a target geometry by an envelope.
contains(containerGeometry, insideGeometry)PromiseIndicates if one geometry contains another geometry.
convexHull(geometry, merge?)PromiseCalculates the convex hull of the input geometry.
crosses(geometry1, geometry2)PromiseIndicates if one geometry crosses another geometry.
cut(geometry, cutter)PromiseSplit the input polyline or polygon where it crosses a cutting polyline. For Polylines, all left cuts will be grouped together in the first Geometry, Right cuts and coincident cuts are grouped in the second Geometry, and each undefined cut, along with any uncut parts, are output as separate Polylines.
densify(geometry, maxSegmentLength, maxSegmentLengthUnit)PromiseDensify geometries by plotting points between existing vertices.
difference(inputGeometry, subtractor)PromiseCreates the difference of two geometries.
disjoint(geometry1, geometry2)PromiseIndicates if one geometry is disjoint (doesn't intersect in any way) with another geometry.
distance(geometry1, geometry2, distanceUnit)PromiseCalculates the shortest planar distance between two geometries.
equals(geometry1, geometry2)PromiseIndicates if two geometries are equal.
extendedSpatialReferenceInfo(spatialReference)PromiseReturns an object containing additional information about the input spatial reference.
flipHorizontal(geometry, flipOrigin?)PromiseFlips a geometry on the horizontal axis.
flipVertical(geometry, flipOrigin?)PromiseFlips a geometry on the vertical axis.
generalize(geometry, maxDeviation, removeDegenerateParts?, maxDeviationUnit?)PromisePerforms the generalize operation on the geometries in the cursor.
geodesicArea(geometry, unit)PromiseCalculates the area of the input geometry.
geodesicBuffer(geometry, distance, unit, unionResults?)PromiseCreates geodesic buffer polygons at a specified distance around the input geometries.
geodesicDensify(geometry, maxSegmentLength, maxSegmentLengthUnit?)PromiseResolves to a geodesically densified version of the input geometry.
geodesicLength(geometry, unit)PromiseCalculates the length of the input geometry.
intersect(geometry, intersector)PromiseCreates a new geometry through intersection between two geometries.
intersects(geometry1, geometry2)PromiseIndicates if one geometry intersects another geometry.
isSimple(geometry)PromiseIndicates if the given geometry is topologically simple.
nearestCoordinate(geometry, inputPoint)PromiseFinds the coordinate of the geometry which is closest to the specified point.
nearestVertex(geometry, inputPoint)PromiseFinds vertex on the geometry nearest to the specified point.
nearestVertices(geometry, inputPoint, searchRadius, maxVertexCountToReturn)PromiseFinds all vertices in the given distance from the specified point, sorted from the closest to the furthest and returns them as an array of objects once resolved.
offset(geometry, offsetDistance, offsetUnit, joinType, bevelRatio?, flattenError?)PromiseCreates offset version of the input geometry.
overlaps(geometry1, geometry2)PromiseIndicates if one geometry overlaps another geometry.
planarArea(geometry, unit)PromiseCalculates the area of the input geometry.
planarLength(geometry, unit)PromiseCalculates the length of the input geometry.
relate(geometry1, geometry2, relation)PromiseIndicates if the given DE-9IM relation holds for the two geometries.
rotate(geometry, angle, rotationOrigin?)PromiseRotates a geometry by a specified angle.
simplify(geometry)PromisePerforms the simplify operation on the geometry which alters the given geometries to make their definitions topologically legal with respect to their geometry type.
symmetricDifference(leftGeometry, rightGeometry)PromiseCreates the symmetric difference of two geometries.
touches(geometry1, geometry2)PromiseIndicates if one geometry touches another geometry.
union(geometries)PromiseAll inputs must be of the same type of geometries and share one spatial reference.
within(innerGeometry, outerGeometry)PromiseIndicates if one geometry is within another geometry.
Method Details

buffer(geometry, distance, unit, unionResults?)

Creates planar (or Euclidean) buffer polygons at a specified distance around the input geometries.

The GeometryEngineAsync has two methods for buffering geometries client-side: buffer and geodesicBuffer(). Use caution when deciding which method to use. As a general rule, use geodesicBuffer() if the input geometries have a spatial reference of either WGS-84 (wkid: 4326) or Web Mercator Auxiliary Sphere (wkid: 3857). Only use buffer (this method) when attempting to buffer geometries with a projected coordinate system other than Web Mercator. If you need to buffer geometries with a geographic coordinate system other than WGS-84 (wkid: 4326), use GeometryService.buffer().
Return type: Promise
Parameters:
<Geometry | Geometry[]> geometry Required The buffer input geometry. The geometry and distance parameters must be specified as either both arrays or both non-arrays. Never specify one as an array and the other a non-array.
<Number | Number[]> distance Required The specified distance(s) for buffering. NOTE: The geometry and distance parameters cannot be mixed. They must either both be specified as arrays, non-arrays, but never both.

When using an array of geometries as input, the length of the geometry array does not have to equal the length of the distance array. For example, if you pass an array of four geometries: [g1, g2, g3, g4] and an array with one distance: [d1], all four geometries will be buffered by the single distance value. If instead you use an array of three distances: [d1, d2, d3], g1 will be buffered by d1, g2 by d2, and g3 and g4 will both be buffered by d3. The value of the geometry array will be matched one to one with those in the distance array until the final value of the distance array is reached, in which case that value will be applied to the remaining geometries.
<String | Number> unit Required Measurement unit for the distance(s). Defaults to the units of the input geometries. Use one of the possible values listed below or any of the numeric codes listed here or here.

Possible Values: meters | feet | kilometers | miles | nautical-miles | yards
<Boolean> unionResults Optional Whether the output geometries should be unioned into a single polygon.

clip(geometry, envelope)

Calculates the clipped geometry from a target geometry by an envelope.
Return type: Promise
Parameters:
<Geometry> geometry Required The geometry to be clipped.
<Extent> envelope Required The envelope used to clip.

contains(containerGeometry, insideGeometry)

Indicates if one geometry contains another geometry.
Return type: Promise
Parameters:
<Geometry> containerGeometry Required The geometry that is tested for the "contains" relationship to the other geometry. Think of this geometry as the potential container of the insideGeometry.
<Geometry> insideGeometry Required The geometry that is tested for the "within" relationship to the containerGeometry.

convexHull(geometry, merge?)

Calculates the convex hull of the input geometry. A convex hull is the smallest convex polygon that encloses a group of objects, such as points. The input geometry can be a point, multipoint, polyline or polygon. The hull is typically a polygon but can also be a polyline or point in degenerate cases.
Return type: Promise
Parameters:
<Geometry | Geometry[]> geometry Required The input geometry.
<Boolean> merge Optional Whether to merge output geometries.

crosses(geometry1, geometry2)

Indicates if one geometry crosses another geometry.
Return type: Promise
Parameters:
<Geometry> geometry1 Required The geometry to cross.
<Geometry> geometry2 Required The geometry being crossed.

cut(geometry, cutter)

Split the input polyline or polygon where it crosses a cutting polyline. For Polylines, all left cuts will be grouped together in the first Geometry, Right cuts and coincident cuts are grouped in the second Geometry, and each undefined cut, along with any uncut parts, are output as separate Polylines. For Polygons, all left cuts are grouped in the first Polygon, all right cuts are in the second Polygon, and each undefined cut, along with any left-over parts after cutting, are output as a separate Polygon. If there were no cuts 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.
Return type: Promise
Parameters:
<Geometry> geometry Required The geometry to be cut.
<Polyline> cutter Required The polyline to cut the geometry.

densify(geometry, maxSegmentLength, maxSegmentLengthUnit)

Densify geometries by plotting points between existing vertices.
Return type: Promise
Parameters:
<Geometry> geometry Required The geometry to be densified.
<Number> maxSegmentLength Required The maximum segment length allowed. Must be a positive value.
<String | Number> maxSegmentLengthUnit Required Measurement unit for maxSegmentLength. Defaults to the units of the input geometries. Use one of the possible values listed below or any of the numeric codes listed here or here.

Possible Values: meters | feet | kilometers | miles | nautical-miles | yards

difference(inputGeometry, subtractor)

Creates the difference of two geometries. The resultant geometry is the part of inputGeometry not in the subtractor. The dimension of subtractor has to be equal to or greater than that of inputGeometry.
Return type: Promise
Parameters:
<Geometry | Geometry[]> inputGeometry Required The input geometry to subtract from.
<Geometry> subtractor Required The geometry being subtracted.

disjoint(geometry1, geometry2)

Indicates if one geometry is disjoint (doesn't intersect in any way) with another geometry.
Return type: Promise
Parameters:
<Geometry> geometry1 Required The base geometry that is tested for the "disjoint" relationship to the other geometry.
<Geometry> geometry2 Required The comparison geometry that is tested for the disjoint relationship to the other geometry.

distance(geometry1, geometry2, distanceUnit)

Calculates the shortest planar distance between two geometries. Distance is reported in the linear units specified by distanceUnit or, if distanceUnit is null, the units of the spatialReference of input geometry.
Return type: Promise
Parameters:
<Geometry> geometry1 Required First input geometry.
<Geometry> geometry2 Required Second input geometry.
<String | Number> distanceUnit Required Measurement unit of the return value. Defaults to the units of the input geometries. Use one of the possible values listed below or any of the numeric codes listed here or here.

Possible Values: meters | feet | kilometers | miles | nautical-miles | yards

equals(geometry1, geometry2)

Indicates if two geometries are equal.
Return type: Promise
Parameters:
<Geometry> geometry1 Required First input geometry.
<Geometry> geometry2 Required Second input geometry.

extendedSpatialReferenceInfo(spatialReference)

Returns an object containing additional information about the input spatial reference. The returned object includes the following properties:
<Number> tolerance The XY tolerance of the spatial reference.
<Number> unitBaseFactor Base factor.
<Number> unitID Unit ID.
<Number> unitSquareDerivative Square derivative.
<Number> unitType Type
Return type: Promise
Parameters:
<SpatialReference> spatialReference Required The input spatial reference.

flipHorizontal(geometry, flipOrigin?)

Flips a geometry on the horizontal axis. Can optionally be flipped around a point.
Return type: Promise
Parameters:
<Geometry> geometry Required The input geometry.
<Point> flipOrigin Optional Point to flip the geometry around. Defaults to the centroid of the geometry.

flipVertical(geometry, flipOrigin?)

Flips a geometry on the vertical axis. Can optionally be flipped around a point.
Return type: Promise
Parameters:
<Geometry> geometry Required The input geometry.
<Point> flipOrigin Optional Point to flip the geometry around. Defaults to the centroid of the geometry.

generalize(geometry, maxDeviation, removeDegenerateParts?, maxDeviationUnit?)

Performs the generalize operation on the geometries in the cursor. Point and Multipoint geometries are left unchanged. Envelope is converted to a Polygon and then generalized.
Return type: Promise
Parameters:
<Geometry> geometry Required The geometry to be generalized.
<Number> maxDeviation Required The maximum allowed deviation from the generalized geometry to the original geometry.
<Boolean> removeDegenerateParts Optional When true, the degenerate parts of the geometry will be removed from the output (may be undesired for drawing).
<String | Number> maxDeviationUnit Optional Measurement unit for maxDeviation. Defaults to the units of the input geometries. Use one of the possible values listed below or any of the numeric codes listed here or here.

Possible Values: meters | feet | kilometers | miles | nautical-miles | yards

geodesicArea(geometry, unit)

Calculates the area of the input geometry. As opposed to planarArea(), geodesicArea takes into account the curvature of the earth when performing this calculation. Therefore, when using input geometries with a spatial reference of either WGS-84 (wkid: 4326) or Web Mercator Auxiliary Sphere (wkid: 3857), it is best practice to calculate areas using geodesicArea(). If the input geometries have a projected coordinate system other than Web Mercator, use planarArea() instead.

This method only works with WGS-84 (wkid: 4326) and Web Mercator (wkid: 3857) spatial references.
Return type: Promise
Parameters:
<Geometry> geometry Required The input geometry.
<String | Number> unit Required Measurement unit of the return value. Defaults to the units of the input geometries. Use one of the possible values listed below or any of the numeric codes listed here.

Possible Values: acres | ares | hectares | square-feet | square-meters | square-yards | square-kilometers | square-miles

geodesicBuffer(geometry, distance, unit, unionResults?)

Creates geodesic buffer polygons at a specified distance around the input geometries. When calculating distances, this method takes the curvature of the earth into account, which provides highly accurate results when dealing with very large geometries and/or geometries that spatially vary widely on a global scale where one projected coordinate system could not accurately plot coordinates and measure distances for all the geometries.

This method only works with WGS-84 (wkid: 4326) and Web Mercator (wkid: 3857) spatial references. In general, if your input geometries are assigned one of those two spatial references, you should always use geodesicBuffer() to obtain the most accurate results for those geometries. If needing to buffer geometries assigned a projected coordinate system other than Web Mercator, use buffer() instead. If the input geometries have a geographic coordinate system other than WGS-84 (wkid: 4326), use GeometryService.buffer().
Return type: Promise
Parameters:
<Geometry | Geometry[]> geometry Required The buffer input geometry. The geometry and distance parameters must be specified as either both arrays or both non-arrays. Never specify one as an array and the other a non-array.
<Number | Number[]> distance Required The specified distance(s) for buffering. NOTE: The geometry and distance parameters cannot be mixed. They must either both be specified as arrays, non-arrays, but never both.

When using an array of geometries as input, the length of the geometry array does not have to equal the length of the distance array. For example, if you pass an array of four geometries: [g1, g2, g3, g4] and an array with one distance: [d1], all four geometries will be buffered by the single distance value. If instead you use an array of three distances: [d1, d2, d3], g1 will be buffered by d1, g2 by d2, and g3 and g4 will both be buffered by d3. The value of the geometry array will be matched one to one with those in the distance array until the final value of the distance array is reached, in which case that value will be applied to the remaining geometries.
<String | Number> unit Required Measurement unit for the distance(s). Defaults to the units of the input geometries. Use one of the possible values listed below or any of the numeric codes listed here or here.

Possible Values: meters | feet | kilometers | miles | nautical-miles | yards
<Boolean> unionResults Optional Whether the output geometries should be unioned into a single polygon.

geodesicDensify(geometry, maxSegmentLength, maxSegmentLengthUnit?)

Resolves to a geodesically densified version of the input geometry. Use this function to draw the line(s) of the geometry along great circles. (Added at v3.15)
Return type: Promise
Parameters:
<Polyline | Polygon> geometry Required A polyline or polygon geometry to densify.
<Number> maxSegmentLength Required The maximum segment length allowed. This must be a positive value.
<Number> maxSegmentLengthUnit Optional Measurement unit for maxSegmentLength. If a unit is not specified, the units are considered to be the same as the units of the geometry. Use any valid linear unit listed here or here.
Sample:
//lineGeom is a line geometry
geometryEngineAsync.geodesicDensify(lineGeom, 10000).then(function(response){
  //response is the densified version of lineGeom
});

geodesicLength(geometry, unit)

Calculates the length of the input geometry. As opposed to planarLength(), geodesicLength() takes into account the curvature of the earth when performing this calculation. Therefore, when using input geometries with a spatial reference of either WGS-84 (wkid: 4326) or Web Mercator Auxiliary Sphere (wkid: 3857), it is best practice to calculate lengths using geodesicLength(). If the input geometries have a projected coordinate system other than Web Mercator, use planarLength() instead.

This method only works with WGS-84 (wkid: 4326) and Web Mercator (wkid: 3857) spatial references.
Return type: Promise
Parameters:
<Geometry> geometry Required The input geometry.
<String | Number> unit Required Measurement unit of the return value. Defaults to the units of the input geometries. Use one of the possible values listed below or any of the numeric codes listed here or here.

Possible Values: meters | feet | kilometers | miles | nautical-miles | yards

intersect(geometry, intersector)

Creates a new geometry through intersection between two geometries.
Return type: Promise
Parameters:
<Geometry | Geometry[]> geometry Required The input geometry.
<Geometry> intersector Required The geometry being intersected.

intersects(geometry1, geometry2)

Indicates if one geometry intersects another geometry.
Return type: Promise
Parameters:
<Geometry> geometry1 Required The geometry that is tested for the intersects relationship to the other geometry.
<Geometry> geometry2 Required The geometry being intersected.

isSimple(geometry)

Indicates if the given geometry is topologically simple.
Return type: Promise
Parameters:
<Geometry> geometry Required Geometry

nearestCoordinate(geometry, inputPoint)

Finds the coordinate of the geometry which is closest to the specified point.
Return type: Promise
Parameters:
<Geometry> geometry Required The geometry to consider.
<Point> inputPoint Required The point used to search the nearest coordinate in the geometry.

nearestVertex(geometry, inputPoint)

Finds vertex on the geometry nearest to the specified point. Once resolved, returns an object with the following properties:
<Point> coordinate The point geometry of the vertex. Includes x, y, and spatialReference properties.
<Number> distance The distance from the vertex to the input point
<Boolean> isRightSide When true, the vertex is to the right of the geometry.
<Number> vertexIndex The index of the vertex.
<Boolean> isEmpty When true, the result is empty.
Return type: Promise
Parameters:
<Geometry> geometry Required The geometry to consider.
<Point> inputPoint Required The point used to search the nearest vertex in the geometry.

nearestVertices(geometry, inputPoint, searchRadius, maxVertexCountToReturn)

Finds all vertices in the given distance from the specified point, sorted from the closest to the furthest and returns them as an array of objects once resolved. Each object (representing one vertex) has the following properties:
<Point> coordinate The point geometry of the vertex. Includes x, y, and spatialReference properties.
<Number> distance The distance from the vertex to the input point
<Boolean> isRightSide When true, the vertex is to the right of the geometry.
<Number> vertexIndex The index of the vertex.
<Boolean> isEmpty When true, the result is empty.
Return type: Promise
Parameters:
<Geometry> geometry Required The geometry to consider.
<Point> inputPoint Required The point from which to measure.
<Number> searchRadius Required The search radius.
<Number> maxVertexCountToReturn Required The maximum number number of vertices to return.

offset(geometry, offsetDistance, offsetUnit, joinType, bevelRatio?, flattenError?)

Creates offset version of the input geometry. The offset operation creates a geometry that is a constant distance from an input polyline or polygon. It is similar to buffering, but produces a one-sided result. If offsetDistance > 0, then the offset geometry is constructed to the right of the oriented input geometry, otherwise it is constructed to the 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. The bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be from the input curve before it is beveled.
Return type: Promise
Parameters:
<Geometry | Geometry[]> geometry Required The geometries to offset.
<Number> offsetDistance Required The offset distance for the Geometries. If offsetDistance > 0, then the offset geometry is constructed to the right of the oriented input geometry, if offsetDistance = 0, then there is no change in the geometries, otherwise it is constructed to the 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.
<String | Number> offsetUnit Required Measurement unit for the offset. Defaults to the units of the input geometries. Use one of the possible values listed below or any of the numeric codes listed here or here.

Possible Values: meters | feet | kilometers | miles | nautical-miles | yards
<String> joinType Required The join type.

Possible Values: round | bevel | miter | square
<Number> bevelRatio Optional Applicable to MITER, bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be located before it is beveled.
<Number> flattenError Optional Applicable to ROUND, flattenError 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.

overlaps(geometry1, geometry2)

Indicates if one geometry overlaps another geometry.
Return type: Promise
Parameters:
<Geometry> geometry1 Required The base geometry that is tested for overlaps relationship to the other geometry.
<Geometry> geometry2 Required The comparison geometry that is tested for the overlaps relationship to the other geometry.

planarArea(geometry, unit)

Calculates the area of the input geometry. As opposed to geodesicArea(), planarArea() performs this calculation using projected coordinates and does not take into account the earth's curvature. When using input geometries with a spatial reference of either WGS-84 (wkid: 4326) or Web Mercator Auxiliary Sphere (wkid: 3857), it is best practice to calculate areas using geodesicArea(). If the input geometries have a projected coordinate system other than Web Mercator, use planarArea() instead.
Return type: Promise
Parameters:
<Geometry> geometry Required The input geometry.
<String | Number> unit Required Measurement unit of the return value. Defaults to the units of the input geometries. Use one of the possible values listed below or any of the numeric codes listed here.

Possible Values: acres | ares | hectares | square-feet | square-meters | square-yards | square-kilometers | square-miles

planarLength(geometry, unit)

Calculates the length of the input geometry. As opposed to geodesicLength(), planarLength() uses projected coordinates and does not take into account the curvature of the earth when performing this calculation. When using input geometries with a spatial reference of either WGS-84 (wkid: 4326) or Web Mercator Auxiliary Sphere (wkid: 3857), it is best practice to calculate lengths using geodesicLength(). If the input geometries have a projected coordinate system other than Web Mercator, use planarLength() instead.
Return type: Promise
Parameters:
<Geometry> geometry Required The input geometry.
<String | Number> unit Required Measurement unit of the return value. Defaults to the units of the input geometries. Use one of the possible values listed below or any of the numeric codes listed here or here.

Possible Values: meters | feet | kilometers | miles | nautical-miles | yards

relate(geometry1, geometry2, relation)

Indicates if the given DE-9IM relation holds for the two geometries.
Return type: Promise
Parameters:
<Geometry> geometry1 Required The first geometry for the relation.
<Geometry> geometry2 Required The second geometry for the relation.
<String> relation Required The Dimensionally Extended 9 Intersection Model (DE-9IM) matrix relation (encoded as a string) to test against the relationship of the two geometries. This string contains the test result of each intersection represented in the DE-9IM matrix. Each result is one character of the string 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 string 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.

See this article and this ArcGIS help page for more information about the DE-9IM model and how string codes are constructed.

rotate(geometry, angle, rotationOrigin?)

Rotates a geometry by a specified angle. Rotation is around the centroid, or a given rotation point.
Return type: Promise
Parameters:
<Geometry> geometry Required The input geometry.
<Number> angle Required The rotation angle
<Point> rotationOrigin Optional Point to rotate the geometry around. Defaults to the centroid of the geometry.

simplify(geometry)

Performs the simplify operation on the geometry which alters the given geometries to make their definitions topologically legal with respect to their geometry type.
Return type: Promise
Parameters:
<Geometry> geometry Required The geometry to be simplified.

symmetricDifference(leftGeometry, rightGeometry)

Creates the symmetric difference of two geometries. The symmetric difference includes the parts which are in either of the sets, but not in both.
Return type: Promise
Parameters:
<Geometry | Geometry[]> leftGeometry Required One of the Geometry instances in the XOR operation.
<Geometry> rightGeometry Required One of the Geometry instances in the XOR operation.

touches(geometry1, geometry2)

Indicates if one geometry touches another geometry.
Return type: Promise
Parameters:
<Geometry> geometry1 Required The geometry which may be touching another geometry.
<Geometry> geometry2 Required The geometry to be touched.

union(geometries)

All inputs must be of the same type of geometries and share one spatial reference.
Return type: Promise
Parameters:
<Geometry[]> geometries Required The geometries to union.
Sample:
require([
  "esri/geometry/Point",
  "esri/geometry/geometryEngineAsync",
  "esri/SpatialReference"
], function (Point, geometryEngineAsync, SpatialReference){

  var pt1 = new Point(-118.15, 33.80, new SpatialReference({wkid: 4326}));
  var pt2 = new Point(-119.15, 32.80, new SpatialReference({wkid: 4326}));

  // Using Module to Union
  geometryEngineAsync.union([pt1, pt2]).then(
    function (res){
      console.log("geometryEngineAsync.union: %o", res);
    }
  );
});

within(innerGeometry, outerGeometry)

Indicates if one geometry is within another geometry.
Return type: Promise
Parameters:
<Geometry> innerGeometry Required The base geometry that is tested for within relationship to the other geometry.
<Geometry> outerGeometry Required The comparison geometry that is tested for the contains relationship to the other geometry.