# GeometryEngine

Performs geometric operations such as spatial relationship tests, reprojections, shape manipulations, topological query and analysis operations on Geometry objects. Capabilities include:

Create new geometries from others with GeometryEngine.buffer(Geometry, Double), GeometryEngine.clip(Geometry, Envelope) and GeometryEngine.union(Geometry, Geometry)

Test spatial relationships between geometries such as GeometryEngine.intersects(Geometry, Geometry) and GeometryEngine.contains(Geometry, Geometry)

Find the GeometryEngine.nearestCoordinate(Geometry, Point) or GeometryEngine.nearestVertex(Geometry, Point) between geometries

Reproject a geometry to another SpatialReference using GeometryEngine.project(Geometry, SpatialReference)

Calculate area and length using GeometryEngine.area(Geometry) and GeometryEngine.length(Geometry), or the geodetic equivalents (GeometryEngine.bufferGeodetic(Geometry, Double, LinearUnit, Double, GeodeticCurveType) and GeometryEngine.lengthGeodetic(Geometry, LinearUnit, GeodeticCurveType)) that account for the curvature of the earth

GeometryEngine generally operates in two dimensions; operations do not account for z-values unless documented as such for a specific method (for example GeometryEngine.project(Geometry, SpatialReference) transforms z-values in some cases).

Geodetic methods are better suited to data that have a geographic spatial reference (see SpatialReference.getIsGeographic()), especially for large-area, small-scale use, while planar methods are suitable to data that have a projected coordinate system, especially for local, large-scale areas. Geodetic methods indicate this in the name, for example GeometryEngine.bufferGeodetic(Geometry, double, LinearUnit, double, GeodeticCurveType).

## Functions

Calculates the area of the given geometry. Planar measurements of distance and area can be extremely inaccurate if using an unsuitable spatial reference. Ensure that you understand the potential for error with the geometry's spatial reference. If you need to calculate more accurate results consider using a different spatial reference, or using the geodetic equivalent, GeometryEngine.areaGeodetic(Geometry, AreaUnit, GeodeticCurveType). See [https://developers.arcgis.com/documentation/spatial-references/] for more information about spatial references.

Calculates the geodesic area of the given geometry. Supports true curves, calculating the result by densifying curves.

Fills the closed gaps between polygons using polygon boundaries and polylines as the boundary for the new polygons. The new polygons are created in the closed empty areas bounded by the edges of the existing polygon boundaries and the new boundary polylines. The newly created polygons do not overlap any existing polygons or polylines, and the boundary of a new polygon must contain at least one edge from the polylines. Only polygons that intersect the input polylines participate in the operation, so it makes sense to prefilter the input accordingly.

Returns a geometry object that represents a buffer relative to the given geometry. Planar measurements of distance and area can be extremely inaccurate if using an unsuitable spatial reference. Ensure that you understand the potential for error with the geometry's spatial reference. If you need to calculate more accurate results consider using a different spatial reference, or using the geodetic equivalent, GeometryEngine.bufferGeodetic(Geometry, Double, LinearUnit, Double, GeodeticCurveType). See [https://developers.arcgis.com/documentation/spatial-references/] for more information about spatial references.

Creates and returns a buffer relative to the given geometries. The geometries must have the same spatial reference. Planar measurements of distance and area can be extremely inaccurate if using an unsuitable spatial reference. Ensure that you understand the potential for error with the geometry's spatial reference. If you need to calculate more accurate results consider using a different spatial reference, or using the geodetic equivalent, GeometryEngine.bufferGeodetic(MutableListImpl, MutableListImpl, LinearUnit, Double, GeodeticCurveType, Boolean). See [https://developers.arcgis.com/documentation/spatial-references/] for more information about spatial references. If unionResult is true, the output collection contains a single result. If geometries is empty, an empty array is returned. Returns null on error.

Calculates the geodesic buffer of a given geometry. Geodesic buffers account for the actual shape of the Earth. Distances are calculated between points on a curved surface (the geoid) as opposed to points on a flat surface (the Cartesian plane).

Calculates the geodesic buffer of the geometries in a given collection. Geodesic buffers account for the actual shape of the Earth. Distances are calculated between points on a curved surface (the geoid) as opposed to points on a flat surface (the Cartesian plane).

Returns the envelope of geometries in the given collection. The given geometries must have consistent spatial references.

Returns the envelope of the two given geometries. The given geometries must have consistent spatial references.

Returns the minimum bounding geometry that completely encloses the given geometry.

Returns the convex hull for the geometries in the given collection. The geometries must have consistent spatial references.

Return the point at the given distance along the line. Supports true curves.

Densifies the input geometry by creating additional vertices along the geometry, using a geodesic curve.

Constructs the set-theoretic difference between two geometries. Supports true curves.

Measures the simple planar distance between two geometries. Planar measurements of distance and area can be extremely inaccurate if using an unsuitable spatial reference. Ensure that you understand the potential for error with the geometry's spatial reference. If you need to calculate more accurate results consider using a different spatial reference, or using the geodetic equivalent, GeometryEngine.distanceGeodetic(Point, Point, LinearUnit, AngularUnit, GeodeticCurveType). See [https://developers.arcgis.com/documentation/spatial-references/] for more information about spatial references.

Calculates the geodesic distance between the two points.

Constructs a geodesic ellipse centered on a specific point.

Extends a polyline using a polyline as the extender. The output polyline has the first and last segment of each path extended to the extender if the segments can be interpolated to intersect the extender. In the case that the segments can be extended to multiple segments of the extender, the shortest extension is chosen. Only end points for paths that are not shared by the end points of other paths are extended. If the polyline cannot be extended by the input extender, then null is returned.

Finds the location on the line nearest the input point, expressed as the fraction along the line's total geodesic length, if the point is within the specified distance from the closest location on the line. The line and point must have consistent spatial references. Supports true curves.

Generalizes the given geometry by removing vertices based on the Douglas-Poiker algorithm. Supports true curves as input, producing a densified curve as output where applicable.

Calculates the intersection of two geometries. The result has the same dimensionality as the lower dimensionality of the two intersecting geometries. If there is no intersection with this dimensionality, returns an empty geometry. For example, the intersection of two polygons (geometries with area, so they have dimensionality of 2) or, say, a polygon and an envelope (also an area) is a polygon. Similarly, the intersection of a polyline (a line, so dimensionality of 1) and another polyline is always a polyline. Therefore when computing the intersection of polylines, this function does not return points where they cross, but rather lines of overlap. If there are no lines of overlap, an empty polyline is returned even if the input lines cross. To obtain all intersections, irrespective of dimensionality, see GeometryEngine.intersections(Geometry, Geometry). Returns an empty geometry if the two input geometries do not intersect. Returns null on error.

Calculates the intersection of two geometries. The returned collection contains one geometry of each dimension for which there are intersections. For example, if both inputs are polylines, the collection contains at most two geometries: the first a multipoint containing the points at which the lines cross, and the second a polyline containing the lines of overlap. If a crossing point lies within a line of overlap, only the line of overlap is present -- the result set is not self-intersecting. If there are no crossing points or there are no lines of overlap, the respective geometry is not be present in the returned collection. If the input geometries do not intersect, the resulting collection is empty. The table below shows, for each combination of pairs of input geometry types, the types of geometry that are contained within the returned collection if there are intersections of that type.

Tests if two geometries intersect. Supports true curves.

Calculates an interior point for the given polygon. This point can be used by clients to place a label for the polygon. Supports true curves.

Calculates the geodesic length of the geometry. Supports true curves, calculating the result by densifying curves.

Moves each point in the point collection by a geodesic distance. There must be the same spatial reference on each point in the input MutableListImpl of points. The returned collection is in the same order as the input, but with new points at their destination locations. Specifying a negative distance moves points in the opposite direction from azimuth.

Determines the nearest point in the input geometry to the input point, by using a shape preserving geodesic approximation of the input geometry. All geometry types are supported for the geometry parameter. Supports true curves.

Returns a ProximityResult that describes the nearest vertex in the input geometry to the input point. Input geometry of type Envelope is not supported. To find the nearest vertex on an Envelope, convert it to a Polygon first.

Folds the geometry into a range of 360 degrees. This may be necessary when wrap around is enabled on the map. Supports true curves.

Creates an offset version of the input geometry. The offset operation creates a geometry that is a constant distance from the input geometry. If is similar to buffering, but produces a one sided result. If distance 0, then the offset geometry is constructed to the right of the input geometry, otherwise it is constructed to the left.

Projects the given geometry from its current spatial reference system into the given spatial reference system. A default best-choice DatumTransformation is applied to the project operation. To control the specific transformation used, use the GeometryEngine.project(Geometry, SpatialReference, DatumTransformation) overload.

Projects the given geometry from its current spatial reference system into the given output spatial reference system, applying the datum transformation provided. Use this overload to project a geometry if the difference between the input geometry's SpatialReference and the outputSpatialReference involves a change of datum, and you do not wish to use the default datum transformation used by GeometryEngine.project(Geometry, SpatialReference).

Reshape polygons or polylines with a single path polyline. Performs the reshape operation on a polygon or polyline using a single path polyline as the reshaper. The output geometry takes the shape of the Multi_path where it first intersects the reshaper to the last intersection. The first and last intersection points of the reshaper are chosen closest to the end points of the reshaper in the case that multiple intersections are found. For polygons, only individual paths can be reshaped. However, polylines can be reshaped across paths. If the geometry cannot be reshaped by the input reshaper, then null is returned.

Constructs a geodesic sector defined by a geodesic arc and 2 radii.

Return a copy of a geometry with the supplied m-value. If the given geometry already has m-values, they are replaced within the resulting geometry by the supplied value. The resulting geometry has Geometry.hasM true. If the m-value supplied is null, then the geometry's m-value will be removed, and the resulting geometry has Geometry.hasM false.

Return a copy of a geometry with the supplied z-coordinate. If the given geometry already has z-coordinates, they are replaced within the resulting geometry by the supplied value. The resulting geometry has Geometry.hasZ true. If the z-coordinate supplied is null, then the geometry's z-coordinate will be removed, and the resulting geometry has Geometry.hasZ false.

Return a copy of a geometry with the supplied z-coordinate and m-value. If the given geometry already has z-coordinates or m-values, they are replaced in the resulting geometry by the supplied values. The resulting geometry has both Geometry.getHasZ() and Geometry.getHasM() true. If the z-coordinate supplied is null, then the geometry's z-coordinate will be removed, and the resulting geometry has Geometry.hasZ false. If the m-value supplied is null, then the geometry's m-value will be removed, and the resulting geometry has Geometry.hasM false.

Calculates the symmetric difference (exclusive or) of the two geometries.

Calculates the union of a collection of geometries There must be at least one geometry in the given collection. The geometries must have consistent spatial references. If the collection contains geometries of differing dimensionality, returns the union of the subset of geometries with the highest dimensionality. E.g. given a collection of polygons, polylines and points, returns the union of the polygons.

Calculates the union of the two geometries. If the two geometries have different dimensionality, returns a copy of the geometry with the higher dimensionality. E.g. if given a polygon and a point, returns the polygon.