# GeometryEngine Class

Provides a set of methods to perform geometric operations on geometry instances. More...

Header: | #include <GeometryEngine> |

Since: | Esri::ArcGISRuntime 100.0 |

Inherits: | Object |

## Public Functions

- 31 public functions inherited from QObject

## Static Public Members

double | area(const Geometry &geometry) |

double | areaGeodetic(const Geometry &geometry, const AreaUnit &unit, GeodeticCurveType curveType) |

QList<Polygon> | autoComplete(const QList<Geometry> &existingBoundaries, const QList<Geometry> &newBoundaries) |

Geometry | boundary(const Geometry &geometry) |

Polygon | buffer(const Geometry &geometry, double distance) |

QList<Polygon> | buffer(const QList<Geometry> &geometries, const QList<double> &distances, bool unionResult) |

Polygon | bufferGeodetic(const Geometry &geometry, double distance, const LinearUnit &unit, double maxDeviation, GeodeticCurveType curveType) |

QList<Polygon> | bufferGeodetic(const QList<Geometry> &geometries, const QList<double> &distances, const LinearUnit &unit, double maxDeviation, GeodeticCurveType curveType, bool unionResult) |

Geometry | clip(const Geometry &geometry, const Envelope &envelope) |

Envelope | combineExtents(const Geometry &geometry1, const Geometry &geometry2) |

Envelope | combineExtents(const QList<Geometry> &geometries) |

bool | contains(const Geometry &geometry1, const Geometry &geometry2) |

Geometry | convexHull(const Geometry &geometry) |

QList<Geometry> | convexHull(const QList<Geometry> &geometries, bool unionResult) |

Point | createPointAlong(const Polyline &polyline, double distance) |

bool | crosses(const Geometry &geometry1, const Geometry &geometry2) |

QList<Geometry> | cut(const Geometry &geometry, const Polyline &cutter) |

Geometry | densify(const Geometry &geometry, double maxSegmentLength) |

Geometry | densifyGeodetic(const Geometry &geometry, double maxSegmentLength, const LinearUnit &lengthUnit, GeodeticCurveType curveType) |

Geometry | difference(const Geometry &geometry1, const Geometry &geometry2) |

bool | disjoint(const Geometry &geometry1, const Geometry &geometry2) |

double | distance(const Geometry &geometry1, const Geometry &geometry2) |

GeodeticDistanceResult | distanceGeodetic(const Point &point1, const Point &point2, const LinearUnit &distanceUnit, const AngularUnit &azimuthUnit, GeodeticCurveType curveType) |

Geometry | ellipseGeodesic(const GeodesicEllipseParameters ¶meters) |

bool | equals(const Geometry &geometry1, const Geometry &geometry2) |

Polyline | extend(const Polyline &polyline, const Polyline &extender, GeometryExtendOptions extendOptions) |

double | fractionAlong(const Polyline &line, const Point &point, double tolerance) |

Geometry | generalize(const Geometry &geometry, double maxDeviation, bool removeDegenerateParts) |

GeometryEngine * | instance() |

Geometry | intersection(const Geometry &geometry1, const Geometry &geometry2) |

QList<Geometry> | intersections(const Geometry &geometry1, const Geometry &geometry2) |

bool | intersects(const Geometry &geometry1, const Geometry &geometry2) |

bool | isSimple(const Geometry &geometry) |

Point | labelPoint(const Polygon &polygon) |

double | length(const Geometry &geometry) |

double | lengthGeodetic(const Geometry &geometry, const LinearUnit &lengthUnit, GeodeticCurveType curveType) |

QList<Point> | moveGeodetic(const QList<Point> &pointCollection, double distance, const LinearUnit &distanceUnit, double azimuth, const AngularUnit &azimuthUnit, GeodeticCurveType curveType) |

ProximityResult | nearestCoordinate(const Geometry &geometry, const Point &point) |

ProximityResult | nearestVertex(const Geometry &geometry, const Point &point) |

Geometry | normalizeCentralMeridian(const Geometry &geometry) |

Geometry | offset(const Geometry &geometry, double distance, GeometryOffsetType offsetType, double bevelRatio, double flattenError) |

bool | overlaps(const Geometry &geometry1, const Geometry &geometry2) |

Geometry | project(const Geometry &geometry, const SpatialReference &spatialReference) |

Geometry | project(const Geometry &geometry, const SpatialReference &spatialReference, DatumTransformation *datumTransformation) |

bool | relate(const Geometry &geometry1, const Geometry &geometry2, const QString &relation) |

Geometry | removeM(const Geometry &geometry) |

Geometry | removeZ(const Geometry &geometry) |

Geometry | removeZAndM(const Geometry &geometry) |

Multipart | reshape(const Multipart &geometry, const Polyline &reshaper) |

Geometry | sectorGeodesic(const GeodesicSectorParameters ¶meters) |

Geometry | setM(const Geometry &geometry, double m) |

Geometry | setZ(const Geometry &geometry, double z) |

Geometry | setZAndM(const Geometry &geometry, double z, double m) |

Geometry | simplify(const Geometry &geometry) |

Geometry | symmetricDifference(const Geometry &geometry1, const Geometry &geometry2) |

bool | touches(const Geometry &geometry1, const Geometry &geometry2) |

Geometry | unionOf(const Geometry &geometry1, const Geometry &geometry2) |

Geometry | unionOf(const QList<Geometry> &geometries) |

bool | within(const Geometry &geometry1, const Geometry &geometry2) |

- 10 static public members inherited from QObject

### Additional Inherited Members

- 1 property inherited from QObject
- 1 public slot inherited from QObject
- 1 signal inherited from Esri::ArcGISRuntime::Object
- 2 signals inherited from QObject
- 1 public variable inherited from QObject
- 9 protected functions inherited from QObject
- 2 protected variables inherited from QObject

## Detailed Description

Provides a set of methods to perform geometric operations on geometry instances.

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

- Create new geometries from others with buffer, clip and unionOf methods.
- Test spatial relationships between geometries such as intersects and contains.
- Find the points of nearest distance between geometries.
- Reproject geometries.
- Calculate area and length.

**Perform planar and geodetic operations**

For some operations, there are methods that use geodetic line interpolation rather than planar (Cartesian). Those methods that use geodetic line interpolation are specified in their descriptions. A geodetic curve follows a path between two points on the Earth's surface when the Earth's surface is approximated by a spheroid.

**Geodetic and geodesic curves**

Not all geodetic curves are geodesic curves. A geodesic curve is one type of geodetic curve: the shortest line between any two points on the Earth's surface on a spheroid (ellipsoid). For a description of all supported geodetic curves, see GeodeticCurveType.

Some methods can operate on different types of geodetic curves. Those methods that only use geodesic curves have the word `geodesic`

in their names.

**Spatial relationships**

GeometryEngine provides methods that determine the spatial relationship between two geometries. If the spatial relationship exists between the two input geometries, then `true`

is returned. If the spatial relationship does not exist between the two input geometries, then `false`

is returned. The spatial relationship test used by this method is based on the Dimensionally Extended 9 Intersection Model (DE-9IM) developed Clementini, et al.

The spatial relationship methods are:

```
SpatialReference srHawaiiStatePlane = SpatialReference(102265);
Geometry geom = GeometryEngine::project(polygonWebMercator, srHawaiiStatePlane);
Polygon polygonHawaiiStatePlane = Polygon(geom);
```

## Member Function Documentation

### GeometryEngine::~GeometryEngine()

Destructor.

`[static] `

double GeometryEngine::area(const Geometry &*geometry*)

Returns the area for the given geometry.

*geometry*- The input geometry.

This is a planar measurement using 2D Cartesian mathematics to compute the area. The geometry must be topologically correct to get its accurate area. Geometries returned by ArcGIS Server services are always topologically correct. If you construct geometries programmatically or if you modify geometries returned by ArcGIS Server, you should first check whether they are simple using isSimple and, if necessary, simplify them using simplify.

`[static] `

double GeometryEngine::areaGeodetic(const Geometry &*geometry*, const AreaUnit &*unit*, GeodeticCurveType *curveType*)

Returns the geodetic area of the input geometry.

*geometry*- The input geometry.*unit*- The unit of measurement for the output value.*curveType*- The GeodeticCurveType to use.

This method will return `-1.0`

when the input geometry is empty.

`[static] `

QList<Polygon> GeometryEngine::autoComplete(const QList<Geometry> &*existingBoundaries*, const QList<Geometry> &*newBoundaries*)

Returns polygons that were created by filling the closed gaps between polygons using polygon boundaries (*existingBoundaries*) and polylines (*newBoundaries*) as the boundary for the new polygons.

If either existingBoundaries or newBoundaries is empty, returns an empty list. 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 polygons in *existingBoundaries* or polylines in *newBoundaries*. Only polygons that intersect the input polylines will participate in the operation, so it makes sense to filter the input accordingly. The geometries in *existingBoundaries* must all have an area, i.e. be polygons or envelopes. The geometries in *newBoundaries* must all be polylines. The geometries in *existingBoundaries* and *newBoundaries* must have the same spatial references.

This function was introduced in Esri::ArcGISRuntime 100.1.

`[static] `

Geometry GeometryEngine::boundary(const Geometry &*geometry*)

Returns the boundary portion of a *geometry*.

Returns a geometry representing the boundary of the input geometry.

- The boundary of a point is an empty geometry. Points have no boundary.
- The boundary of a polygon is a polyline describing its outer and inner rings.
- The boundary of a polyline are its end points.

`[static] `

Polygon GeometryEngine::buffer(const Geometry &*geometry*, double *distance*)

Returns a buffer polygon.

*geometry*- The input geometry.*distance*- The distance to buffer the input geometry.

Calculates the buffer with simple 2D distances. The distance is expressed in the same unit of measurement as the spatial reference of *geometry*.

`[static] `

QList<Polygon> GeometryEngine::buffer(const QList<Geometry> &*geometries*, const QList<double> &*distances*, bool *unionResult*)

Returns a buffer of each geometry in the list by the corresponding distance.

*geometries*- A QList of geometries to buffer.*distances*- The distance to buffer each geometry, expressed as a list of double values. If the size of the distances array is less than the number of geometries, the last distance value is used for the rest of geometries.*unionResult*- Whether to union the resulting geometries. If true, a single polygon that buffers all the geometries is returned, else one buffer polygon for each in the given collection is returned.

This function was introduced in Esri::ArcGISRuntime 100.1.

`[static] `

Polygon GeometryEngine::bufferGeodetic(const Geometry &*geometry*, double *distance*, const LinearUnit &*unit*, double *maxDeviation*, GeodeticCurveType *curveType*)

Returns a geodetic buffer polygon of a given geometry.

*geometry*- The input geometry.*distance*- The distance to buffer the input geometry.*unit*- The unit of measurement for the input distance.*maxDeviation*- The maximum deviation between points.*curveType*- The GeodeticCurveType to use.

`[static] `

QList<Polygon> GeometryEngine::bufferGeodetic(const QList<Geometry> &*geometries*, const QList<double> &*distances*, const LinearUnit &*unit*, double *maxDeviation*, GeodeticCurveType *curveType*, bool *unionResult*)

Buffers all geometries in the list by the corresponding geodetic distance.

*geometries*- A QList of geometries to buffer.*distances*- The distance to buffer each geometry, expressed as a list of double values. If the size of the distances array is less than the number of geometries, the last distance value is used for the rest of geometries.*unit*- The unit of measurement for the input distance.*maxDeviation*- The maximum deviation between points.*curveType*- The GeodeticCurveType to use.*unionResult*- Whether to union the resulting geometries. If true, a single polygon that buffers all the geometries is returned, else one buffer polygon for each in the given collection is returned.

This function was introduced in Esri::ArcGISRuntime 100.1.

`[static] `

Geometry GeometryEngine::clip(const Geometry &*geometry*, const Envelope &*envelope*)

Returns the portion of a *geometry* that intersects an *envelope*.

`[static] `

Envelope GeometryEngine::combineExtents(const Geometry &*geometry1*, const Geometry &*geometry2*)

Returns an Envelope representing the minimum extent that encloses both *geometry1* and *geometry2*.

The given geometries must be of the same spatial references.

This function was introduced in Esri::ArcGISRuntime 100.1.

`[static] `

Envelope GeometryEngine::combineExtents(const QList<Geometry> &*geometries*)

Returns an Envelope representing the minimum extent that encloses all *geometries* in the list.

The given geometries must be of the same spatial references.

This function was introduced in Esri::ArcGISRuntime 100.1.

`[static] `

bool GeometryEngine::contains(const Geometry &*geometry1*, const Geometry &*geometry2*)

Returns whether *geometry1* contains *geometry2*.

Geometry1 contains geometry2 if geometry2 lies completely within geometry1.

`[static] `

Geometry GeometryEngine::convexHull(const Geometry &*geometry*)

Returns the convex hull of a *geometry*.

A convex hull is a geometry whose vertices are the smallest set of vertices needed to surround the input geometry. One way to visualize this is as a rubber band stretched around a polygon that has some concave sides.

`[static] `

QList<Geometry> GeometryEngine::convexHull(const QList<Geometry> &*geometries*, bool *unionResult*)

Returns the convex hull of each of the *geometries* in the list.

If *unionResult* is true a single geometry that encloses all the geometries is returned, otherwise one enclosing geometry for each in the given collection is returned.

A convex hull is a geometry whose vertices are the smallest set of vertices needed to surround the input geometry. One way to visualize this is as a rubber band stretched around a polygon that has some concave sides.

This function was introduced in Esri::ArcGISRuntime 100.1.

`[static] `

Point GeometryEngine::createPointAlong(const Polyline &*polyline*, double *distance*)

Returns the point at the given distance along the line.

If distance is less than or equal to zero, the point returned is coincident with the start of the line. If distance is greater than or equal to the line's length, the point returned is coincident with the end of the line. If the line has multiple parts, and the distance falls exactly on a boundary between two parts, the returned point will be coincident with either the end of one part or the start of the next, which is indeterminate.

*polyline*- The polyline from which point is created.*distance*- The distance along the line of the point to return, in the line's units.

This function was introduced in Esri::ArcGISRuntime 100.2.

`[static] `

bool GeometryEngine::crosses(const Geometry &*geometry1*, const Geometry &*geometry2*)

Returns whether *geometry1* and *geometry2* cross.

Geometries cross when they have some but not all of their interiors in common, and when the geometry representing their intersection has a dimension that is less that at least one of the input geometries.

An example of this is when a polyline's interior (the portion between the end points) intersects a polygon's interior (the part within the boundary ring) but some part of the polyline's interior is outside the polygon. Therefore, some of the interior of the polyline is not in common with the polygon's interior, and the intersection geometry is a polyline with a dimension 1. A polygon's dimension is 2.

`[static] `

QList<Geometry> GeometryEngine::cut(const Geometry &*geometry*, const Polyline &*cutter*)

Returns a list of cut geometries.

*geometry*- The input geometry to be cut.*cutter*- The polyline that will be used to divide the geometry into pieces where they cross the cutter.

The cutter and geometry's spatial references must match. If there were no cuts the an empty list will be returned.

This function was introduced in Esri::ArcGISRuntime 100.1.

`[static] `

Geometry GeometryEngine::densify(const Geometry &*geometry*, double *maxSegmentLength*)

Returns a geometry densified on a 2D plane.

*geometry*- The input geometry to densify.*maxSegmentLength*- The maximum distance between vertices after densification.

Returns the geometry densified by adding vertices between existing vertices. Returns the original geometry if the input geometry is not a Polygon or Polyline or if maxSegmentLength < 0.

`[static] `

Geometry GeometryEngine::densifyGeodetic(const Geometry &*geometry*, double *maxSegmentLength*, const LinearUnit &*lengthUnit*, GeodeticCurveType *curveType*)

Returns a geometry densified using a geodetic curve.

*geometry*- The input geometry.*maxSegmentLength*- The maximum distance between points in the densified geometry.*lengthUnit*- The unit of measurement for maxSegmentLength*curveType*- The GeodeticCurveType to use.

`[static] `

Geometry GeometryEngine::difference(const Geometry &*geometry1*, const Geometry &*geometry2*)

Returns the geometric difference of *geometry1* and *geometry2*.

The output geometry is the part of geometry1 that does not intersect geometry2. The dimension of geometry2 must be equal to or greater than the dimension of geometry1.

`[static] `

bool GeometryEngine::disjoint(const Geometry &*geometry1*, const Geometry &*geometry2*)

Returns whether *geometry1* and *geometry2* are disjoint.

Geometries are disjoint if their boundaries, interiors, or any combination thereof do not intersect.

`[static] `

double GeometryEngine::distance(const Geometry &*geometry1*, const Geometry &*geometry2*)

Returns the 2D planar distance between *geometry1* and *geometry2*.

The distance between geometries is calculated as the simple straight-line distance using the coordinate system in the input geometry's spatial reference.

`[static] `

GeodeticDistanceResult GeometryEngine::distanceGeodetic(const Point &*point1*, const Point &*point2*, const LinearUnit &*distanceUnit*, const AngularUnit &*azimuthUnit*, GeodeticCurveType *curveType*)

Returns the geodetic distance between two points, and the azimuths from one to another.

*point1*A point object.*point2*Another point object*distanceUnit*- The LinearUnit of measurement for the returned results.*azimuthUnit*- The AngularUnit of measurement for the returned results.*curveType*- The GeodeticCurveType to use.

`[static] `

Geometry GeometryEngine::ellipseGeodesic(const GeodesicEllipseParameters &*parameters*)

Returns a geodesic ellipse centered on a specific point.

*parameters*- The GeodesicEllipseParameters to use.

This method can return an ellipse as a Polygon, Polyline, or Multipoint geometry.

A geodesic ellipse is defined by a center point, the lengths of its semi-major and semi-minor axes, and the angular direction of its semi-major axis.

This method returns an empty geometry when:

`parameters`

is empty.`parameters.center`

is empty.`parameters.center`

does not contain a valid spatial reference`parameters.geometryType`

is Envelope or Point.- Either semi-axis length is less than zero.

**See also **GeodesicEllipseParameters.

`[static] `

bool GeometryEngine::equals(const Geometry &*geometry1*, const Geometry &*geometry2*)

Returns whether *geometry1* and *geometry2* are equal.

`[static] `

Polyline GeometryEngine::extend(const Polyline &*polyline*, const Polyline &*extender*, GeometryExtendOptions *extendOptions*)

Returns a polyline which is a result of extending a *polyline* with an *extender* using the type of extension specified with *extendOptions* flags.

The output polyline will have 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 will be extended. If the *polyline* cannot be extended by the input *extender*, then a empty polyline will be returned.

This function was introduced in Esri::ArcGISRuntime 100.1.

`[static] `

double GeometryEngine::fractionAlong(const Polyline &*line*, const Point &*point*, double *tolerance*)

Returns the length along the line nearest the input point, expressed as the fraction of the line's length between 0.0 and 1.0, or NAN if the point is outside the tolerance.

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 the same spatial references.

*line*- The line to locate the point's distance along its length.*point*- The point to locate.*tolerance*- The maximum distance that a point is allowed to be from the line, in the units of the SpatialReference. If the tolerance is -1, the fraction of the closest location on the line is always returned as long as the point lies between the two ends of the polyline. If the distance from the point to the closest location on the line is greater than the tolerance, or the tolerance is -1 and the point does not lie between the two ends of the polyline, NAN is returned.

This function was introduced in Esri::ArcGISRuntime 100.6.

`[static] `

Geometry GeometryEngine::generalize(const Geometry &*geometry*, double *maxDeviation*, bool *removeDegenerateParts*)

Returns a geometry generalized by removing some vertices.

The Douglas-Peucker algorithm {with enhancements) is used to generalize the geometry. The algorithm simplifies complex lines by reducing the number of points used to represent them.

*geometry*- The input geometry.*maxDeviation*- The maximum distance that the generalized geometry can deviate from the original one, specified in the units of the input geometry's spatial reference.*removeDegenerateParts*- Whether degenerate parts of the generalized geometry that are undesired for drawing will be removed.

`[static] `

GeometryEngine *GeometryEngine::instance()

Returns an instance of the GeometryEngine singleton.

The instance is used to connect to the Object::errorOccurred signal. You do not need to obtain the instance to call the static methods on the GeometryEngine.

`[static] `

Geometry GeometryEngine::intersection(const Geometry &*geometry1*, const Geometry &*geometry2*)

Returns a geometry representing the intersection of *geometry1* and *geometry2*.

`[static] `

QList<Geometry> GeometryEngine::intersections(const Geometry &*geometry1*, const Geometry &*geometry2*)

Returns a list of geometry objects that represent the intersection of *geometry1* and *geometry2*.

The returned list contains one geometry of each dimension for which there are intersections. For example, if both inputs are polylines, the collection will contain 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 will not be present in the returned list.

If the input geometries do not intersect, the resulting list will be empty.

The grid below shows, for each combination of pairs of input geometry types, the types of geometry that will be contained within the returned list if there are intersections of that type.

Input type | Point/Multipoint | Polyline | Polygon/Envelope |
---|---|---|---|

Point/Multipoint | Multipoint | Multipoint | Multipoint |

Polyline | Multipoint | Multipoint, Polyline | Multipoint, Polyline |

Polygon/Envelope | Multipoint | Multipoint, Polyline | Multipoint, Polyline, Polygon |

The geometries in the returned list are sorted by ascending dimensionality, e.g. multipoint (dimension 0) then polyline (dimension 1) then polygon (dimension 2) for the intersection of two geometries with area that have intersections of those types.

`[static] `

bool GeometryEngine::intersects(const Geometry &*geometry1*, const Geometry &*geometry2*)

Returns whether *geometry1* intersects *geometry2*.

`[static] `

bool GeometryEngine::isSimple(const Geometry &*geometry*)

Returns whether the input *geometry* is simple.

You can simplify geometries by calling simplify when required. This property allows you to check whether you need to call simplify, which creates a copy of the original Geometry.

When the polyline has z values, the degenerate segments are those that are shorter than the tolerance in x,y plane, and the change in z value along the segment is less than or equal to the z tolerance.

For Polygons, exterior rings are clockwise, and interior rings (holes) are counterclockwise. Rings can touch other rings in finite number of points. Rings can be self-tangent in finite number of points. Vertices are either exactly coincident, or further than the tolerance from each other. If a vertex is not equal to any boundary point of a segment, it must be further than tolerance from any segment. No segment length is zero or less than tolerance. Each path contains at least three non-equal vertices. No empty paths allowed. Order of rings does not matter.

Point geometry is always simple.

For Multipoints, there can be no point with exactly equal x and y values. The tolerance is not considered in this comparison.

**Note: **Tolerance for x, y, z, and m-values is provided in or calculated from the spatial reference.

`[static] `

Point GeometryEngine::labelPoint(const Polygon &*polygon*)

Returns the label point for a *polygon*.

A label point lies in the interior of the polygon near the center of gravity.

`[static] `

double GeometryEngine::length(const Geometry &*geometry*)

Returns the length of the given geometry.

*geometry*- The input geometry.

Returns the length using the same unit of measurement as the geometry's spatial reference.

`[static] `

double GeometryEngine::lengthGeodetic(const Geometry &*geometry*, const LinearUnit &*lengthUnit*, GeodeticCurveType *curveType*)

Returns the geodetic length of a geometry.

*geometry*- The input geometry.*lengthUnit*- The LinearUnit of measurement for the returned results.*curveType*- The GeodeticCurveType to use.

`[static] `

QList<Point> GeometryEngine::moveGeodetic(const QList<Point> &*pointCollection*, double *distance*, const LinearUnit &*distanceUnit*, double *azimuth*, const AngularUnit &*azimuthUnit*, GeodeticCurveType *curveType*)

Moves all points in the point collection in a specified direction by a geodetic distance.

*pointCollection*- A QList of point objects.*distance*- The distance to move the points.*distanceUnit*- The LinearUnit of measurement for distance.*azimuth*- The azimuth angle of the direction for the points.*azimuthUnit*- The AngularUnit of measurement for azimuth.*curveType*- The GeodeticCurveType to use.

`[static] `

ProximityResult GeometryEngine::nearestCoordinate(const Geometry &*geometry*, const Point &*point*)

Returns a ProximityResult that describes the nearest *point* in the input geometry to the input point.

Input *geometry* of type Envelope is not supported. To find the nearest coordinate on an Envelope, convert it to a Polygon first.

`[static] `

ProximityResult GeometryEngine::nearestVertex(const Geometry &*geometry*, const Point &*point*)

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.

`[static] `

Geometry GeometryEngine::normalizeCentralMeridian(const Geometry &*geometry*)

Returns a geometry folded into the 360-degree range of its associated spatial reference.

*geometry*- The input geometry to fold.

Folding is used when a geometry intersects the minimum or maximum meridian of the spatial reference, or when geometry is completely outside of the meridian range.

Use this method when editing geometries on a map that has wraparound enabled. In these cases, it is imperative to fold geometries, as the original coordinates correspond to the frame of the map. For example, if you add new features to a map with wraparound enabled, and then you pan west across the dateline several times, the coordinates of the newly added features would be incorrectly outside of the spatial reference's maximum extent until they were folded using this static method.

The geometry's spatial reference must be a pannable projected coordinate system (PCS) or a geographic coordinate system (GCS). A pannable PCS is a rectangular PCS where the x-coordinate range corresponds to a 360-degree range on the defining GCS. A GCS is always pannable.

Folding does not preserve geodetic area or length. Folding does not preserve the perimeter of a polygon.

Returns the folded geometry. The result geometry will be completely inside the coordinate system extent. If geometry or its spatial reference are empty, an empty geometry is returned. If the geometry's spatial reference is not pannable, the input geometry is returned. If the geometry is a non-empty envelope, this method returns a polygon.

`[static] `

Geometry GeometryEngine::offset(const Geometry &*geometry*, double *distance*, GeometryOffsetType *offsetType*, double *bevelRatio*, double *flattenError*)

Returns an offset version of the input geometry.

*geometry*- The input geometry.*distance*- The offset distance for the new geometry.*offsetType*- The GeometryOffsetType to produce in the resulting geometry.*bevelRatio*- The ratio used to produce a bevel join instead of a miter join (used only when the offset type is Miter).*flattenError*- The maximum distance of the resulting segments compared to the true circular arc (used only when offsetType is GeometryOffsetType::Rounded).

The offset operation creates a geometry that is a constant distance from the input geometry. This is similar to buffering, but produces a one-sided result instead of one that surrounds the input geometry. If *distance* > 0 then the offset geometry is constructed to the right of the input geometry, otherwise it is constructed to the left.

`[static] `

bool GeometryEngine::overlaps(const Geometry &*geometry1*, const Geometry &*geometry2*)

Returns whether *geometry1* and *geometry2* overlap.

Two geometries overlap when they have the same dimension and when their intersection result is a geometry of the same dimension. If the intersection result is a geometry with a lesser dimension than the input geometries, then method returns `false`

.

For example: two input polygons must return a polygon to overlap. If two polygons intersect each other at exactly one point then no overlap has occurred because the intersection result is a point whose dimension is zero.

`[static] `

Geometry GeometryEngine::project(const Geometry &*geometry*, const SpatialReference &*spatialReference*)

Returns a geometry projected into a new spatial reference.

*geometry*- The input geometry.*spatialReference*- The output spatial reference.

`[static] `

Geometry GeometryEngine::project(const Geometry &*geometry*, const SpatialReference &*spatialReference*, DatumTransformation **datumTransformation*)

Returns a geometry projected into a new spatial reference using given datum transformation.

*geometry*- The input geometry.*spatialReference*- The output spatial reference.*datumTransformation*- The datum transformation.

This function was introduced in Esri::ArcGISRuntime 100.2.

`[static] `

bool GeometryEngine::relate(const Geometry &*geometry1*, const Geometry &*geometry2*, const QString &*relation*)

Returns whether *geometry1* and *geometry2* have a specific spatial *relation*.

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: '*').

For 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 DE-9IM and this help page for more information about the DE-9IM model and how string codes are constructed.

`[static] `

Geometry GeometryEngine::removeM(const Geometry &*geometry*)

Returns a copy of the given *geometry* with its m-values removed.

This function was introduced in Esri::ArcGISRuntime 100.1.

`[static] `

Geometry GeometryEngine::removeZ(const Geometry &*geometry*)

Returns a copy of the given *geometry* with its z coordinate removed.

This function was introduced in Esri::ArcGISRuntime 100.1.

`[static] `

Geometry GeometryEngine::removeZAndM(const Geometry &*geometry*)

Returns a copy of the given *geometry* with its z coordinates and m-values removed.

This function was introduced in Esri::ArcGISRuntime 100.1.

`[static] `

Multipart GeometryEngine::reshape(const Multipart &*geometry*, const Polyline &*reshaper*)

Returns a polygon or polyline reshaped with a single path polyline.

*geometry*- The polygon or polyline to be reshaped.*reshaper*- The single path polyline reshaper.

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 an empty polygon or polyline is returned.

This function was introduced in Esri::ArcGISRuntime 100.1.

`[static] `

Geometry GeometryEngine::sectorGeodesic(const GeodesicSectorParameters &*parameters*)

Returns a geodesic sector defined by a geodesic arc and two radii.

*parameters*- The GeodesicSectorParameters to use.

This method can produce a sector as a polygon, polyline or multipoint geometry.

A geodesic sector is defined by a geodesic elliptical arc and two radii extending from the center point of the arc to the points where they each intersect the arc.

The arc is a portion of an ellipse. The ellipse is defined by a center point, the lengths of its semi-major and semi-minor axes, and the direction of its semi-major axis.

The first radius of the sector is defined by the start direction angle relative to the direction of the semi-major axis. The second radius is the sum of the start direction and the sector angle.

This method will return an empty geometry when:

`parameters`

is empty.- parameters.center is empty or is outside the horizon of the spatial reference.
- parameters.center does not contain a valid spatial reference or is a local spatial reference.
- parameters.geometryType is Envelope or Point.
- Either semi-axis length is less than zero.

**See also **GeodesicSectorParameters.

`[static] `

Geometry GeometryEngine::setM(const Geometry &*geometry*, double *m*)

Returns a copy of a *geometry* with the supplied *m* value.

If the given geometry already has *m* values, they will be replaced within the resulting geometry by the supplied *m* value.

This function was introduced in Esri::ArcGISRuntime 100.1.

`[static] `

Geometry GeometryEngine::setZ(const Geometry &*geometry*, double *z*)

Returns a copy of a *geometry* with the supplied *z* coordinate.

If the given geometry already has z coordinates, they will be replaced within the resulting geometry by the supplied z value.

This function was introduced in Esri::ArcGISRuntime 100.1.

`[static] `

Geometry GeometryEngine::setZAndM(const Geometry &*geometry*, double *z*, double *m*)

Returns a copy of a *geometry* with the supplied *z* and *m* values.

If the given geometry already has z coordinates or m-values, they will be replaced in the resulting geometry by the supplied z and m-values.

This function was introduced in Esri::ArcGISRuntime 100.1.

`[static] `

Geometry GeometryEngine::simplify(const Geometry &*geometry*)

Simplifies the given geometry to make it topologically consistent according to its geometry type.

*geometry*- The input geometry.

Returns a simplified copy of the input geometry.

`[static] `

Geometry GeometryEngine::symmetricDifference(const Geometry &*geometry1*, const Geometry &*geometry2*)

Returns a geometry that represents the symmetric difference between *geometry1* and *geometry2*.

The symmetric difference includes the parts which are in either of the geometries, but not in both.

`[static] `

bool GeometryEngine::touches(const Geometry &*geometry1*, const Geometry &*geometry2*)

Returns whether the borders of *geometry1* and *geometry2* touch.

`[static] `

Geometry GeometryEngine::unionOf(const Geometry &*geometry1*, const Geometry &*geometry2*)

Returns the union of *geometry1* and *geometry2*.

Both input geometries must be of the same geometry type and share the same spatial reference.

`[static] `

Geometry GeometryEngine::unionOf(const QList<Geometry> &*geometries*)

Returns the union of the *geometries* in the list.

All geometries must be of the same geometry type and share the same spatial reference.

This function was introduced in Esri::ArcGISRuntime 100.1.

`[static] `

bool GeometryEngine::within(const Geometry &*geometry1*, const Geometry &*geometry2*)

Returns whether *geometry1* is completely within *geometry2*.