GeometryEngine Class

  • GeometryEngine
  • class Esri::ArcGISRuntime::GeometryEngine

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

    Header: #include <GeometryEngine.h>
    Since: Esri::ArcGISRuntime 100.0
    Inherits: Esri::ArcGISRuntime::Object

    Public Functions

    virtual ~GeometryEngine() override

    Static Public Members

    double area(const Esri::ArcGISRuntime::Geometry &geometry)
    double areaGeodetic(const Esri::ArcGISRuntime::Geometry &geometry, const Esri::ArcGISRuntime::AreaUnit &unit, Esri::ArcGISRuntime::GeodeticCurveType curveType)
    QList<Esri::ArcGISRuntime::Polygon> autoComplete(const QList<Esri::ArcGISRuntime::Geometry> &existingBoundaries, const QList<Esri::ArcGISRuntime::Geometry> &newBoundaries)
    Esri::ArcGISRuntime::Geometry boundary(const Esri::ArcGISRuntime::Geometry &geometry)
    Esri::ArcGISRuntime::Polygon buffer(const Esri::ArcGISRuntime::Geometry &geometry, double distance)
    QList<Esri::ArcGISRuntime::Polygon> buffer(const QList<Esri::ArcGISRuntime::Geometry> &geometries, const QList<double> &distances, bool unionResult)
    Esri::ArcGISRuntime::Polygon bufferGeodetic(const Esri::ArcGISRuntime::Geometry &geometry, double distance, const Esri::ArcGISRuntime::LinearUnit &unit, double maxDeviation, Esri::ArcGISRuntime::GeodeticCurveType curveType)
    QList<Esri::ArcGISRuntime::Polygon> bufferGeodetic(const QList<Esri::ArcGISRuntime::Geometry> &geometries, const QList<double> &distances, const Esri::ArcGISRuntime::LinearUnit &unit, double maxDeviation, Esri::ArcGISRuntime::GeodeticCurveType curveType, bool unionResult)
    Esri::ArcGISRuntime::Geometry clip(const Esri::ArcGISRuntime::Geometry &geometry, const Esri::ArcGISRuntime::Envelope &envelope)
    Esri::ArcGISRuntime::Envelope combineExtents(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)
    Esri::ArcGISRuntime::Envelope combineExtents(const QList<Esri::ArcGISRuntime::Geometry> &geometries)
    bool contains(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)
    Esri::ArcGISRuntime::Geometry convexHull(const Esri::ArcGISRuntime::Geometry &geometry)
    QList<Esri::ArcGISRuntime::Geometry> convexHull(const QList<Esri::ArcGISRuntime::Geometry> &geometries, bool unionResult)
    Esri::ArcGISRuntime::Point createPointAlong(const Esri::ArcGISRuntime::Polyline &polyline, double distance)
    bool crosses(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)
    QList<Esri::ArcGISRuntime::Geometry> cut(const Esri::ArcGISRuntime::Geometry &geometry, const Esri::ArcGISRuntime::Polyline &cutter)
    Esri::ArcGISRuntime::Geometry densify(const Esri::ArcGISRuntime::Geometry &geometry, double maxSegmentLength)
    Esri::ArcGISRuntime::Geometry densifyGeodetic(const Esri::ArcGISRuntime::Geometry &geometry, double maxSegmentLength, const Esri::ArcGISRuntime::LinearUnit &lengthUnit, Esri::ArcGISRuntime::GeodeticCurveType curveType)
    Esri::ArcGISRuntime::Geometry difference(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)
    bool disjoint(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)
    double distance(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)
    Esri::ArcGISRuntime::GeodeticDistanceResult distanceGeodetic(const Esri::ArcGISRuntime::Point &point1, const Esri::ArcGISRuntime::Point &point2, const Esri::ArcGISRuntime::LinearUnit &distanceUnit, const Esri::ArcGISRuntime::AngularUnit &azimuthUnit, Esri::ArcGISRuntime::GeodeticCurveType curveType)
    Esri::ArcGISRuntime::Geometry ellipseGeodesic(const Esri::ArcGISRuntime::GeodesicEllipseParameters &parameters)
    bool equals(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)
    Esri::ArcGISRuntime::Polyline extend(const Esri::ArcGISRuntime::Polyline &polyline, const Esri::ArcGISRuntime::Polyline &extender, Esri::ArcGISRuntime::GeometryExtendOptions extendOptions)
    double fractionAlong(const Esri::ArcGISRuntime::Polyline &line, const Esri::ArcGISRuntime::Point &point, double tolerance)
    Esri::ArcGISRuntime::Geometry generalize(const Esri::ArcGISRuntime::Geometry &geometry, double maxDeviation, bool removeDegenerateParts)
    Esri::ArcGISRuntime::GeometryEngine *instance()
    Esri::ArcGISRuntime::Geometry intersection(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)
    QList<Esri::ArcGISRuntime::Geometry> intersections(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)
    bool intersects(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)
    bool isSimple(const Esri::ArcGISRuntime::Geometry &geometry)
    Esri::ArcGISRuntime::Point labelPoint(const Esri::ArcGISRuntime::Polygon &polygon)
    double length(const Esri::ArcGISRuntime::Geometry &geometry)
    double lengthGeodetic(const Esri::ArcGISRuntime::Geometry &geometry, const Esri::ArcGISRuntime::LinearUnit &lengthUnit, Esri::ArcGISRuntime::GeodeticCurveType curveType)
    Esri::ArcGISRuntime::Geometry move(const Esri::ArcGISRuntime::Geometry &geometry, double deltaX, double deltaY)
    QList<Esri::ArcGISRuntime::Point> moveGeodetic(const QList<Esri::ArcGISRuntime::Point> &pointCollection, double distance, const Esri::ArcGISRuntime::LinearUnit &distanceUnit, double azimuth, const Esri::ArcGISRuntime::AngularUnit &azimuthUnit, Esri::ArcGISRuntime::GeodeticCurveType curveType)
    Esri::ArcGISRuntime::ProximityResult nearestCoordinate(const Esri::ArcGISRuntime::Geometry &geometry, const Esri::ArcGISRuntime::Point &point)
    Esri::ArcGISRuntime::ProximityResult nearestCoordinateGeodetic(const Esri::ArcGISRuntime::Geometry &geometry, const Esri::ArcGISRuntime::Point &point, double maxDeviation, const Esri::ArcGISRuntime::LinearUnit &deviationUnit)
    Esri::ArcGISRuntime::ProximityResult nearestVertex(const Esri::ArcGISRuntime::Geometry &geometry, const Esri::ArcGISRuntime::Point &point)
    Esri::ArcGISRuntime::Geometry normalizeCentralMeridian(const Esri::ArcGISRuntime::Geometry &geometry)
    Esri::ArcGISRuntime::Geometry offset(const Esri::ArcGISRuntime::Geometry &geometry, double distance, Esri::ArcGISRuntime::GeometryOffsetType offsetType, double bevelRatio, double flattenError)
    bool overlaps(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)
    Esri::ArcGISRuntime::Geometry project(const Esri::ArcGISRuntime::Geometry &geometry, const Esri::ArcGISRuntime::SpatialReference &spatialReference)
    Esri::ArcGISRuntime::Geometry project(const Esri::ArcGISRuntime::Geometry &geometry, const Esri::ArcGISRuntime::SpatialReference &spatialReference, Esri::ArcGISRuntime::DatumTransformation *datumTransformation)
    bool relate(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2, const QString &relation)
    Esri::ArcGISRuntime::Geometry removeM(const Esri::ArcGISRuntime::Geometry &geometry)
    Esri::ArcGISRuntime::Geometry removeZ(const Esri::ArcGISRuntime::Geometry &geometry)
    Esri::ArcGISRuntime::Geometry removeZAndM(const Esri::ArcGISRuntime::Geometry &geometry)
    Esri::ArcGISRuntime::Multipart reshape(const Esri::ArcGISRuntime::Multipart &geometry, const Esri::ArcGISRuntime::Polyline &reshaper)
    Esri::ArcGISRuntime::Geometry rotate(const Esri::ArcGISRuntime::Geometry &geometry, double angle, const Esri::ArcGISRuntime::Point &origin)
    Esri::ArcGISRuntime::Geometry scale(const Esri::ArcGISRuntime::Geometry &geometry, double scaleX, double scaleY, const Esri::ArcGISRuntime::Point &origin)
    Esri::ArcGISRuntime::Geometry sectorGeodesic(const Esri::ArcGISRuntime::GeodesicSectorParameters &parameters)
    Esri::ArcGISRuntime::Geometry setM(const Esri::ArcGISRuntime::Geometry &geometry, double m)
    Esri::ArcGISRuntime::Geometry setZ(const Esri::ArcGISRuntime::Geometry &geometry, double z)
    Esri::ArcGISRuntime::Geometry setZAndM(const Esri::ArcGISRuntime::Geometry &geometry, double z, double m)
    Esri::ArcGISRuntime::Geometry simplify(const Esri::ArcGISRuntime::Geometry &geometry)
    Esri::ArcGISRuntime::Geometry symmetricDifference(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)
    bool touches(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)
    Esri::ArcGISRuntime::Geometry unionOf(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)
    Esri::ArcGISRuntime::Geometry unionOf(const QList<Esri::ArcGISRuntime::Geometry> &geometries)
    bool within(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)

    Detailed Description

    Capabilities include:

    • Create new geometries from others with buffer(const Esri::ArcGISRuntime::Geometry&, double), clip(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::Envelope&) and unionOf(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::Geometry&).
    • Test spatial relationships between geometries such as intersects(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::Geometry&) and contains(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::Geometry&).
    • Find the nearestCoordinate(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::Point&) or nearestVertex(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::Point&) between geometries.
    • Reproject a geometry to another SpatialReference using project(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::SpatialReference&).
    • Calculate area and length using area(const Esri::ArcGISRuntime::Geometry&) and length(const Esri::ArcGISRuntime::Geometry&), or the geodetic equivalents (bufferGeodetic(const Esri::ArcGISRuntime::Geometry&, double, const Esri::ArcGISRuntime::LinearUnit&, double, Esri::ArcGISRuntime::GeodeticCurveType) and lengthGeodetic(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::LinearUnit&, Esri::ArcGISRuntime::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 project(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::SpatialReference&) transforms z-values in some cases).

    GeometryEngine provides both planar (Euclidean) and geodetic versions of many operations. Be aware that methods named with only the operation are the planar versions (buffer(const Esri::ArcGISRuntime::Geometry&, double), for example), while the geodetic equivalent has "Geodetic" appended to the name (for example bufferGeodetic(const Esri::ArcGISRuntime::Geometry&, double, const Esri::ArcGISRuntime::LinearUnit&, double, Esri::ArcGISRuntime::GeodeticCurveType)).

    Planar methods are suitable for data with a projected coordinate system, especially for local, large-scale areas. Geodetic methods are better suited to data with a geographic spatial reference (see SpatialReference::isGeographic), especially for large-area, small-scale use.

    Most GeometryEngine methods require inputs to have equivalent spatial references. The methods which have more than one geometry parameter, or have a separate spatial reference parameter which could conflict with that of the geometry, will throw if the spatial references are not equivalent. Exceptions to this rule (for example rotate(const Esri::ArcGISRuntime::Geometry&, double, const Esri::ArcGISRuntime::Point&) are highlighted in the method documentation.

    Member Function Documentation

    [override virtual] GeometryEngine::~GeometryEngine()

    Destructor.

    [static] double GeometryEngine::area(const Esri::ArcGISRuntime::Geometry &geometry)

    Returns the area for the given geometry.

    • geometry - A geometry object.

    This planar measurement uses 2D Cartesian mathematics to compute the area. It is based upon the SpatialReference of the input geometry. If the input geometry does not use an 'area preserving' spatial reference, the result can be inaccurate. You have two options available to calculate a more accurate result:

    • Use a different spatial reference. Use the project(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::SpatialReference&) method to project the geometry to a projected coordinate system that is better suited for area calculations. See Spatial references and Supported map projections for more information.
    • Use the geodetic equivalent, areaGeodetic(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::AreaUnit&, Esri::ArcGISRuntime::GeodeticCurveType).

    Geometry must be topologically correct to accurately calculate area. Polygons that are self-intersecting or that have inconsistent ring orientations may produce inaccurate area values. In some cases, area values for polygons with incorrect topology may be negative. Geometries returned by ArcGIS Server services are always topologically correct. To ensure that polygons constructed or modified programmatically are topologically consistent, however, it's best to simplify the input geometry using simplify(const Esri::ArcGISRuntime::Geometry&) before you call this method.

    Supports true curves.

    [static] double GeometryEngine::areaGeodetic(const Esri::ArcGISRuntime::Geometry &geometry, const Esri::ArcGISRuntime::AreaUnit &unit, Esri::ArcGISRuntime::GeodeticCurveType curveType)

    Returns the geodetic area of the given geometry using a geodetic curve.

    • geometry - A geometry object.
    • unit - The unit of measure for the return value. If empty, the default unit is meters squared.
    • curveType - The type of curve to calculate the geodetic area.

    Calculating area using a geodetic measurement accounts for the curvature of the Earth's surface. Using geodetic algorithms to calculate areas and distances provides a highly accurate way to obtain measurements of geographic features, typically superior to that returned by the area(const Esri::ArcGISRuntime::Geometry&) method, which provides a planar measurement that can introduce distortion depending on the SpatialReference the geometry is in.

    Geometry must be topologically correct to accurately calculate area. Polygons that are self-intersecting or that have inconsistent ring orientations may produce inaccurate area values. In some cases, area values for polygons with incorrect topology may be negative. Geometries returned by ArcGIS Server services are always topologically correct. To ensure that polygons constructed or modified programmatically are topologically consistent, however, it's best to simplify the input geometry using simplify(const Esri::ArcGISRuntime::Geometry&) before you call this method.

    Supports true curves, calculating the result by densifying curves.

    [static, since Esri::ArcGISRuntime 100.1] QList<Esri::ArcGISRuntime::Polygon> GeometryEngine::autoComplete(const QList<Esri::ArcGISRuntime::Geometry> &existingBoundaries, const QList<Esri::ArcGISRuntime::Geometry> &newBoundaries)

    Fills the closed gaps between polygons using polygon boundaries and polylines as the boundary for the new polygons.

    • existingBoundaries - The polygons.
    • newBoundaries - The polylines.

    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.

    All geometries in the existingBoundaries collection must have an area. They must be polygons or envelopes.

    All geometries in newBoundaries collection must be polylines.

    Use of a true curve geometry as input is not supported by this method and will emit the errorOccurred signal with ErrorType::CommonNotImplemented.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [static] Esri::ArcGISRuntime::Geometry GeometryEngine::boundary(const Esri::ArcGISRuntime::Geometry &geometry)

    Returns the boundary of the given geometry.

    Returns a geometry representing the boundary of the input geometry. Supports true curves.

    • geometry - A geometry object.

    For Point - returns an empty geometry. Points have no boundary. For Multipoint - returns an empty geometry. Points have no boundary. For Polyline - returns a multipoint containing the end points of the polyline's parts. For Polygon - returns a polyline describing its outer and inner rings.

    Supports true curves

    [static] Esri::ArcGISRuntime::Polygon GeometryEngine::buffer(const Esri::ArcGISRuntime::Geometry &geometry, double distance)

    Returns a buffer polygon at the specified distance around the given geometry.

    This is a planar buffer operation. Use bufferGeodetic to produce geodetic buffers.

    • geometry - A geometry object.
    • distance - The distance to buffer the geometry. It must be in the same units as the geometry's spatial reference.

    This planar measurement uses 2D Cartesian mathematics to compute the buffer area. It is based upon the SpatialReference of the input geometry. If the input geometry does not use an 'area preserving' spatial reference, the result can be inaccurate. You have two options available to calculate a more accurate result:

    • Use a different spatial reference. Use the project(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::SpatialReference&) method to project the geometry to a projected coordinate system that is better suited for area calculations. See Spatial references and Supported map projections for more information.
    • Use the geodetic equivalent, bufferGeodetic(const Esri::ArcGISRuntime::Geometry&, double, const Esri::ArcGISRuntime::LinearUnit&, double, Esri::ArcGISRuntime::GeodeticCurveType).

    Supports true curves as input, producing a densified curve as output where applicable.

    [static, since Esri::ArcGISRuntime 100.1] QList<Esri::ArcGISRuntime::Polygon> GeometryEngine::buffer(const QList<Esri::ArcGISRuntime::Geometry> &geometries, const QList<double> &distances, bool unionResult)

    Returns a buffer or buffers relative to the given collection of geometries.

    This is a planar buffer operation. Use bufferGeodetic(const Esri::ArcGISRuntime::Geometry&, double, const Esri::ArcGISRuntime::LinearUnit&, double, Esri::ArcGISRuntime::GeodeticCurveType) to produce geodetic buffers.

    • geometries - A collection of geometries.
    • distances - The distance to buffer each geometry, expressed as a QList of double. If the size of the distances collection is less than the number of geometries, the last distance value is used for the rest of geometries.
    • unionResult - Returns a single geometry that buffers all the geometries (true), or one buffer for each in the given collection (false).

    This planar measurement uses 2D Cartesian mathematics to compute the buffer areas. It is based upon the SpatialReference of the input geometries. If the input geometries do not use an 'area preserving' spatial reference, the results can be inaccurate. You have two options available to calculate a more accurate results:

    • Use a different spatial reference. Use the project(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::SpatialReference&) method to project the geometry to a projected coordinate system that is better suited for area calculations. See Spatial references and Supported map projections for more information.
    • Use the geodetic equivalent, bufferGeodetic(const QList<Esri::ArcGISRuntime::Geometry>&, const QList<double>&, const Esri::ArcGISRuntime::LinearUnit&, double, Esri::ArcGISRuntime::GeodeticCurveType, bool).

    If unionResult is true, the output collection contains a single result. If geometries is empty, an empty array is returned.

    Supports true curves as input, producing a densified curve as output where applicable.

    This method allows you to create different-sized buffers for each input in a geometry collection using corresponding values in a distance collection. Typically, there's a one-to-one correspondence of input geometries to the input buffer distances. However, you may have fewer input buffer distances than input geometries. In that case, the last distance value in the buffer distances collection is applied to the remaining geometries. If needed, you could also specify a single buffer value in the input buffer distances collection to apply to all items in the input geometries collection.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [static] Esri::ArcGISRuntime::Polygon GeometryEngine::bufferGeodetic(const Esri::ArcGISRuntime::Geometry &geometry, double distance, const Esri::ArcGISRuntime::LinearUnit &unit, double maxDeviation, Esri::ArcGISRuntime::GeodeticCurveType curveType)

    Returns a buffer polygon at the specified distance around the given geometry, calculated using a geodetic curve.

    • geometry - A geometry object.
    • distance - The distance to buffer the geometry.
    • unit - The unit of measure for the distance.
    • maxDeviation - The maximum deviation between points. If NaN then a maximum deviation of up to 0.2% of the buffer distance, with a maximum of 0.01 meters, aiming to give an output geometry with a smooth boundary.
    • curveType - The GeodeticCurveType used to calculate the buffer.

    Geodetic 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).

    Negative distance can be used to create a buffer inside a Polygon or an Envelope. Using a negative buffer distance shrinks the geometry's boundary by the distance specified. Note that if the negative buffer distance is large enough, the geometry may collapse to an empty polygon.

    Supports true curves as input, and may produce a densified curve as output.

    [static, since Esri::ArcGISRuntime 100.1] QList<Esri::ArcGISRuntime::Polygon> GeometryEngine::bufferGeodetic(const QList<Esri::ArcGISRuntime::Geometry> &geometries, const QList<double> &distances, const Esri::ArcGISRuntime::LinearUnit &unit, double maxDeviation, Esri::ArcGISRuntime::GeodeticCurveType curveType, bool unionResult)

    Returns a geodetic buffer or buffers relative to the given collection of geometries.

    • geometries - A collection of geometries.
    • distances - The distance to buffer each geometry, expressed as a QList of double. 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 measure for the distance.
    • maxDeviation - The maximum deviation between points. If NaN then a maximum deviation of up to 0.2% of the buffer distance, with a maximum of 0.01 meters, aiming to give an output geometry with a smooth boundary.
    • curveType - The GeodeticCurveType used to calculate the buffer.
    • unionResult - Return a single geometry that buffers all the geometries (true), or one buffer for each in the given collection (false).

    Geodetic 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).

    Negative distance can be used to create buffers inside polygons. Using a negative buffer distance shrinks the polygons' boundaries by the distance specified. Note that if the negative buffer distance is large enough, polygons may collapse to empty geometries.

    Use of a true curve geometry as input is not supported by this method and will emit the errorOccurred signal with ErrorType::CommonNotImplemented.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [static] Esri::ArcGISRuntime::Geometry GeometryEngine::clip(const Esri::ArcGISRuntime::Geometry &geometry, const Esri::ArcGISRuntime::Envelope &envelope)

    Returns the portion of a geometry that intersects an envelope.

    • geometry - The geometry to be clipped by the given envelope.
    • envelope - The envelope that clips the given geometry.

    If the Geometry intersects the Envelope, the portion of the Geometry contained within the Envelope is returned. If no part of the Geometry lies within the Envelope, an empty Geometry is returned. If the Geometry lies completely within the Envelope, the entire Geometry is returned.

    Supports true curves.

    [static, since Esri::ArcGISRuntime 100.1] Esri::ArcGISRuntime::Envelope GeometryEngine::combineExtents(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)

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

    • geometry1 - A geometry object.
    • geometry2 - Another geometry object.

    Supports true curves.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [static, since Esri::ArcGISRuntime 100.1] Esri::ArcGISRuntime::Envelope GeometryEngine::combineExtents(const QList<Esri::ArcGISRuntime::Geometry> &geometries)

    Returns an Envelope representing the minimum extent that encloses all geometries in the given collection.

    • geometries - A collection of geometries.

    Supports true curves.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [static] bool GeometryEngine::contains(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)

    Returns a bool that tests if geometry1 contains geometry2.

    • geometry1 - A geometry object.
    • geometry2 - Another geometry object.

    This spatial relationship test is based on the Dimensionally Extended 9 Intersection Model (DE-9IM) developed by Clementini, et al., and is discussed further in the web pages: DE-9IM and Spatial relationships.

    Supports true curves.

    [static] Esri::ArcGISRuntime::Geometry GeometryEngine::convexHull(const Esri::ArcGISRuntime::Geometry &geometry)

    Calculates the minimum bounding geometry (convex hull) that completely encloses the given geometry.

    • geometry - A geometry object.

    The convex hull is the minimal bounding geometry that encloses the input geometry, such that all outer angles are convex. If you imagine a rubber band stretched around the input geometry, the rubber band takes the shape of the convex hull.

    Use of a true curve geometry as input is not supported by this method and will emit the errorOccurred signal with ErrorType::CommonNotImplemented.

    [static, since Esri::ArcGISRuntime 100.1] QList<Esri::ArcGISRuntime::Geometry> GeometryEngine::convexHull(const QList<Esri::ArcGISRuntime::Geometry> &geometries, bool unionResult)

    Calculates the minimum bounding geometry (convex hull) for the geometries in the given collection.

    • geometries - A collection of geometries.
    • unionResult - true indicates that a single convex hull geometry is calculated that encloses all the geometries in the collection. false indicates that one convex hull geometry is calculated for each geometry in the collection.

    If merge is true, returns a single convex hull that encloses all the geometries in the collection as a single geometry in an array. If merge is false, returns the minimum bounding geometry that completely encloses each of the geometries in the given collection as an array of geometries. If geometries is empty, returns an empty array.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [static, since Esri::ArcGISRuntime 100.2] Esri::ArcGISRuntime::Point GeometryEngine::createPointAlong(const Esri::ArcGISRuntime::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 is coincident with either the end of one part or the start of the next, but which one is undetermined.

    • polyline - The polyline from which point is created.
    • distance - The distance along the polyline where the point is created, using the units of the polyline.

    Supports true curves.

    This function was introduced in Esri::ArcGISRuntime 100.2.

    [static] bool GeometryEngine::crosses(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)

    Returns a bool that tests if geometry1 crosses geometry2.

    • geometry1 - A geometry object.
    • geometry2 - Another geometry object.

    Two polylines cross if their intersection contains only points, and at least one of the points of intersection is internal to both polylines. A polyline and polygon cross if a connected part of the polyline is partly inside and partly outside the polygon. A polyline and polygon cross if they share a polyline in common on the interior of the polygon, which is not equal to the entire polyline. The target and join features must be either polylines or polygons.

    This spatial relationship test is based on the Dimensionally Extended 9 Intersection Model (DE-9IM) developed by Clementini, et al., and is discussed further in the web pages: DE-9IM and Spatial relationships.

    Supports true curves.

    [static, since Esri::ArcGISRuntime 100.1] QList<Esri::ArcGISRuntime::Geometry> GeometryEngine::cut(const Esri::ArcGISRuntime::Geometry &geometry, const Esri::ArcGISRuntime::Polyline &cutter)

    Cuts the 'geometry' into parts with the 'cutter' Polyline.

    • geometry - The input Geometry to be cut.
    • cutter - The Polyline used to divide the geometry into pieces where they cross the cutter.

    When a Polyline or Polygon is cut, it is split where it intersects the cutter Polyline. The cut parts are output as a collection of geometries. All left cuts are grouped together in the first Geometry, all right cuts are grouped in the second Geometry, any uncut parts are output as separate geometries.

    If the input polyline is not simple, then the operation will be performed on a simplified copy of the polyline. There is no need for you to call any simplify method. If there were no cuts then an empty QList is returned.

    Supports true curves.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [static] Esri::ArcGISRuntime::Geometry GeometryEngine::densify(const Esri::ArcGISRuntime::Geometry &geometry, double maxSegmentLength)

    Densifies the input geometry by inserting additional vertices along the geometry at an interval defined by maxSegmentLength.

    • geometry - An {Esri::ArcGISRuntime::Envelope} {Envelope}, Polyline or Polygon geometry.
    • maxSegmentLength - The maximum distance between vertices when the input geometry is densified, in the given linear units. The linear unit is assumed to be that of the input geometry's spatial reference (decimal degrees for a geometry with a geographic spatial reference, meters for geometry with a Mercator spatial reference, and so on). Use SpatialReference::unit to determine the unit used by a specific spatial reference.

    Additional vertices are not inserted on segments of the input {Esri::ArcGISRuntime::Envelope} {Envelope}, Polygon, or Polyline that are shorter than maxSegmentLength.

    Supports true curves as input, producing a densified curve as output where applicable.

    [static] Esri::ArcGISRuntime::Geometry GeometryEngine::densifyGeodetic(const Esri::ArcGISRuntime::Geometry &geometry, double maxSegmentLength, const Esri::ArcGISRuntime::LinearUnit &lengthUnit, Esri::ArcGISRuntime::GeodeticCurveType curveType)

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

    • geometry - The input geometry to densify.
    • maxSegmentLength - The maximum distance between vertices when the input geometry is densified.
    • lengthUnit - The unit of measurement for maxSegmentLength. If null, meters are assumed.
    • curveType - The GeodeticCurveType to use.

    Use of a true curve geometry as input is not supported by this method and will emit the errorOccurred signal with ErrorType::CommonNotImplemented.

    [static] Esri::ArcGISRuntime::Geometry GeometryEngine::difference(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)

    Returns the set-theoretic difference between two geometries.

    • geometry1 - A geometry object.
    • geometry2 - The second geometry of dimension equal to or greater than the elements of the first geometry.

    This method returns a geometry consisting of the parts of geometry1 that are not in geometry2. It performs a spatial subtraction from the two input geometries. The order of the two input geometry arguments produces different results if they are switched. Think of the difference equation as:

    A (Difference) B != B (Difference) A

    Use symmetricDifference(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::Geometry&) to get the parts that are in either geometry, but not in both.

    Supports true curves.

    [static] bool GeometryEngine::disjoint(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)

    Returns a bool that tests if the two geometries are disjoint.

    • geometry1 - A geometry object.
    • geometry2 - Another geometry object.

    Geometries are disjoint if their boundaries or interiors do not intersect.

    This spatial relationship test is based on the Dimensionally Extended 9 Intersection Model (DE-9IM) developed by Clementini, et al., and is discussed further in the web pages: DE-9IM and Spatial relationships.

    Supports true curves.

    [static] double GeometryEngine::distance(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)

    Calculates the simple planar (Euclidean) distance between two geometries.

    • geometry1 - A geometry object.
    • geometry2 - Another geometry object.

    This planar measurement uses 2D Cartesian mathematics to compute the distance. It is based upon the SpatialReference of the input geometries. If the input geometries do not use an 'distance preserving' spatial reference, the result can be inaccurate. You have two options available to calculate a more accurate result:

    • Use a different spatial reference. Use the project(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::SpatialReference&) method to project the geometry to a projected coordinate system that is better suited for area calculations. See Spatial references and Supported map projections for more information.
    • Use the geodetic equivalent, distanceGeodetic(const Esri::ArcGISRuntime::Point&, const Esri::ArcGISRuntime::Point&, const Esri::ArcGISRuntime::LinearUnit&, const Esri::ArcGISRuntime::AngularUnit&, Esri::ArcGISRuntime::GeodeticCurveType).

    Supports true curves, calculating the result by densifying curves.

    [static] Esri::ArcGISRuntime::GeodeticDistanceResult GeometryEngine::distanceGeodetic(const Esri::ArcGISRuntime::Point &point1, const Esri::ArcGISRuntime::Point &point2, const Esri::ArcGISRuntime::LinearUnit &distanceUnit, const Esri::ArcGISRuntime::AngularUnit &azimuthUnit, Esri::ArcGISRuntime::GeodeticCurveType curveType)

    Calculates the geodetic distance between two given points and calculates the azimuth at both points for the geodetic curve that connects the points.

    • point1 A point object.
    • point2 Another point object
    • distanceUnit - The linear unit of measurement for the returned results. Assumes meters if no unit is given.
    • azimuthUnit - The angular unit of measurement for the returned results. Assumes degrees if no unit is given.
    • curveType - The type of curve to calculate.

    [static] Esri::ArcGISRuntime::Geometry GeometryEngine::ellipseGeodesic(const Esri::ArcGISRuntime::GeodesicEllipseParameters &parameters)

    Returns a geodesic ellipse centered on a specific point.

    • parameters - Various parameters needed to construct the ellipse.

    Constructs a geodesic ellipse centered on the specified point. It returns a piecewise approximation of a geodesic ellipse (or geodesic circle, if GeodesicEllipseParameters::semiAxis1Length = GeodesicEllipseParameters::semiAxis2Length) consisting of LineSegment objects.

    If this method is used to generate a polygon or a polyline, the result may have more than one path, depending on the size of the ellipse and its position relative to the horizon of the coordinate system. When the method generates a polyline or a multipoint, the result vertices lie on the boundary of the ellipse. When a polygon is generated, the interior of the polygon is the interior of the ellipse, however the boundary of the polygon may contain segments from the spatial reference horizon, or from the geographic coordinate system extent.

    If the smaller axis is zero, the ellipse will degenerate to a line segment, a point, or an empty geometry (depending on the larger axis and output type). Otherwise, if GeodesicEllipseParameters::maxPointCount < 10, the number of vertices will default to 10. Supported output geometry types are Polygon, Polyline, add Multipoint.

    [static] bool GeometryEngine::equals(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)

    Returns a bool that tests if two geometries are equal.

    • geometry1 - A geometry object.
    • geometry2 - Another geometry object.

    The geometries are equal if they have the same spatial reference systems, geometry type, points and occupy the same space. For a more strict comparison of the two geometries use the equivalency operator (aka ==).

    Supports true curves.

    [static, since Esri::ArcGISRuntime 100.1] Esri::ArcGISRuntime::Polyline GeometryEngine::extend(const Esri::ArcGISRuntime::Polyline &polyline, const Esri::ArcGISRuntime::Polyline &extender, Esri::ArcGISRuntime::GeometryExtendOptions extendOptions)

    Extends a polyline using a polyline as the extender using the type of extension specified with extendOptions.

    • polyline - The polyline to be extended.
    • extender - The polyline to extend to.
    • extendOptions - The flag for the type of extend operation to perform.

    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 empty is returned.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [static, since Esri::ArcGISRuntime 100.6] double GeometryEngine::fractionAlong(const Esri::ArcGISRuntime::Polyline &line, const Esri::ArcGISRuntime::Point &point, double tolerance)

    Returns 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.

    • 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.

    Supports true curves.

    This function was introduced in Esri::ArcGISRuntime 100.6.

    [static] Esri::ArcGISRuntime::Geometry GeometryEngine::generalize(const Esri::ArcGISRuntime::Geometry &geometry, double maxDeviation, bool removeDegenerateParts)

    Generalizes the given geometry by removing vertices based on the Douglas-Poiker algorithm.

    • geometry - A geometry object.
    • maxDeviation - The maximum distance that the generalized geometry can deviate from the original, in the same units as the geometry's spatial reference system.
    • removeDegenerateParts - true if degenerate parts of the resulting geometry that are undesired for drawing are removed, false otherwise.

    Point and Multipoint geometries are left unchanged. Envelope is converted to a Polygon and then generalized.

    Supports true curves as input, producing a densified curve as output where applicable.

    [static] Esri::ArcGISRuntime::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] Esri::ArcGISRuntime::Geometry GeometryEngine::intersection(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)

    Calculates the intersection of two geometries.

    • geometry1 - A geometry object.
    • geometry2 - Another geometry object.

    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 intersections(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::Geometry&).

    Returns an empty geometry if the two input geometries do not intersect.

    Supports true curves.

    See also intersections(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::Geometry&).

    [static] QList<Esri::ArcGISRuntime::Geometry> GeometryEngine::intersections(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)

    Calculates the intersection of two geometries.

    • geometry1 - A geometry object.
    • geometry2 - Another geometry object.

    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 intersections.

    Input typePoint/MultipointPolylinePolygon/Envelope
    Point/MultipointMultipointMultipointMultipoint
    PolylineMultipointMultipoint, PolylineMultipoint, Polyline
    Polygon/EnvelopeMultipointMultipoint, PolylineMultipoint, Polyline, Polygon

    Returns an empty geometry if the two input geometries do not intersect.

    Supports true curves.

    See also intersection(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::Geometry&).

    [static] bool GeometryEngine::intersects(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)

    Returns a bool that tests if two geometries intersect each other.

    • geometry1 - A geometry object.
    • geometry2 - Another geometry object.

    A geometry intersects another geometry if it shares any portion of its geometry with the other geometry feature. If either geometry contain, is within, crosses, touches, or overlaps the other geometry, they intersect.

    This spatial relationship test is based on the Dimensionally Extended 9 Intersection Model (DE-9IM) developed by Clementini, et al., and is discussed further in the web pages: DE-9IM and Spatial relationships.

    Supports true curves.

    [static] bool GeometryEngine::isSimple(const Esri::ArcGISRuntime::Geometry &geometry)

    Returns a bool that tests if the geometry is topologically simple.

    • geometry - The geometry object.

    Point geometry is always simple.

    Multipoint geometries cannot have any points with exactly equal x and y.

    Polyline geometries cannot have degenerate segments. When the polyline has no z, the degenerate segments are those that have a length in the xy plane less than or equal to the tolerance. When the polyline has z, the degenerate segments are those that are shorter than the tolerance in the xy plane, and the change in the z-value along the segment is less than or equal to the z-tolerance.

    Polygon geometries are considered simple if the following is true:

    • Exterior rings are clockwise, and interior rings (holes) are counterclockwise.
    • Rings can touch other rings in a finite number of points.
    • Rings can be self-tangent in a finite number of points.
    • No segment length is zero.
    • Each path contains at least three non-equal vertices.
    • No empty paths allowed.
    • Order of rings does not matter.

    Supports true curves.

    [static] Esri::ArcGISRuntime::Point GeometryEngine::labelPoint(const Esri::ArcGISRuntime::Polygon &polygon)

    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.

    [static] double GeometryEngine::length(const Esri::ArcGISRuntime::Geometry &geometry)

    Calculates the length of the given geometry.

    • geometry - A geometry object.

    This planar measurement uses 2D Cartesian mathematics to compute the length. It is based upon the SpatialReference of the input geometry. If the input geometry is not using an 'distance preserving' spatial reference, the result can be inaccurate. You have two options available to calculate a more accurate result:

    • Use a different spatial reference. Use the project(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::SpatialReference&) method to project the geometry to a projected coordinate system that is better suited for area calculations. See Spatial references and Supported map projections for more information.
    • Use the geodetic equivalent, lengthGeodetic(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::LinearUnit&, Esri::ArcGISRuntime::GeodeticCurveType).

    Supports true curves.

    [static] double GeometryEngine::lengthGeodetic(const Esri::ArcGISRuntime::Geometry &geometry, const Esri::ArcGISRuntime::LinearUnit &lengthUnit, Esri::ArcGISRuntime::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.

    Supports true curves, calculating the result by densifying curves.

    [static, since Esri::ArcGISRuntime 200.2] Esri::ArcGISRuntime::Geometry GeometryEngine::move(const Esri::ArcGISRuntime::Geometry &geometry, double deltaX, double deltaY)

    Moves the provided geometry by the specified distances along the x-axis and y-axis.

    • geometry - The geometry to move.
    • deltaX - The distance to move the geometry along the x-axis, in the units of the given geometry's spatial reference.
    • deltaY - The distance to move the geometry along the y-axis, in the units of the given geometry's spatial reference.

    Planar measurements of distance 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. For input geometries with a geographic spatial reference, consider projecting to an appropriate projected coordinate system before attempting to move them, as the distance represented by angular units of measure will differ depending on the geometry's location on the Earth. See https://developers.arcgis.com/documentation/spatial-references/ for more information about spatial references.

    Supports true curves.

    {GeometryEditor::moveSelectedElement(double, double)}, {Esri::ArcGISRuntime::GeometryEditor::moveSelectedElement(const Esri::ArcGISRuntime::Point&)} {GeometryEditor::moveSelectedElement(const Esri::ArcGISRuntime::Point&)}

    This function was introduced in Esri::ArcGISRuntime 200.2.

    See also moveGeodetic(const QList<Esri::ArcGISRuntime::Point>&, double, const Esri::ArcGISRuntime::LinearUnit&, double, const Esri::ArcGISRuntime::AngularUnit&, Esri::ArcGISRuntime::GeodeticCurveType), rotate(const Esri::ArcGISRuntime::Geometry&, double, const Esri::ArcGISRuntime::Point&), scale(const Esri::ArcGISRuntime::Geometry&, double, double, const Esri::ArcGISRuntime::Point&), and Esri::ArcGISRuntime::GeometryEditor::moveSelectedElement(double, double).

    [static] QList<Esri::ArcGISRuntime::Point> GeometryEngine::moveGeodetic(const QList<Esri::ArcGISRuntime::Point> &pointCollection, double distance, const Esri::ArcGISRuntime::LinearUnit &distanceUnit, double azimuth, const Esri::ArcGISRuntime::AngularUnit &azimuthUnit, Esri::ArcGISRuntime::GeodeticCurveType curveType)

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

    • pointCollection - A QList of Point geometries. Contents of the QList are copied.
    • distance - The distance to move the points.
    • distanceUnit - The unit of measure for distance. If empty, meters are assumed.
    • azimuth - The azimuth angle of the direction for the points.
    • azimuthUnit - The angular unit of measure for azimuth. If empty, degrees are assumed.
    • curveType - The type of curve to calculate.

    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.

    [static] Esri::ArcGISRuntime::ProximityResult GeometryEngine::nearestCoordinate(const Esri::ArcGISRuntime::Geometry &geometry, const Esri::ArcGISRuntime::Point &point)

    Determines the nearest point in the input geometry to the input point using a simple planar measurement.

    • geometry - A geometry object.
    • point - The point of interest.

    Input geometry of type Envelope is not supported. To find the nearest coordinate on an Envelope, convert it to a Polygon first using boundary(const Esri::ArcGISRuntime::Geometry&).

    If the specified geometry is a polyline or polygon the nearest coordinate is the closest point in a segment that comprises geometry; it may not necessarily be the closest vertex of a segment. If you want to obtain the closest vertex in the polyline or polygon use the nearestVertex(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::Point&) method instead.

    This calculation uses 2D Cartesian mathematics to compute the nearest coordinate. It is based upon the SpatialReference of the input geometries. If the input geometries do not use an 'distance preserving' spatial reference, the result can be inaccurate. You have two options available to calculate a more accurate result:

    • Use a different spatial reference. Use the project(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::SpatialReference&) method to project the geometry to a projected coordinate system that is better suited for area calculations. See Spatial references and Supported map projections for more information.
    • Use the geodetic equivalent, nearestCoordinateGeodetic(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::Point&, double, const Esri::ArcGISRuntime::LinearUnit&).

    Supports true curves.

    [static, since Esri::ArcGISRuntime 100.14] Esri::ArcGISRuntime::ProximityResult GeometryEngine::nearestCoordinateGeodetic(const Esri::ArcGISRuntime::Geometry &geometry, const Esri::ArcGISRuntime::Point &point, double maxDeviation, const Esri::ArcGISRuntime::LinearUnit &deviationUnit)

    Determines the nearest point in the input geometry to the input point, by using a shape preserving geodetic approximation of the input geometry.

    • geometry - A geometry object on which to calculate the nearest coordinate to the point parameter.
    • point - The point from which to calculate the nearest coordinate on the geometry parameter.
    • maxDeviation - The maximum distance that the geodetic geometry can deviate from the original, in the units of the deviationUnit parameter.
    • deviationUnit - The unit of measure for the maxDeviation parameter. If empty, the units of maxDeviation are assumed to be meters.

    Supports true curves.

    This function was introduced in Esri::ArcGISRuntime 100.14.

    See also GeometryEngine::nearestCoordinate.

    [static] Esri::ArcGISRuntime::ProximityResult GeometryEngine::nearestVertex(const Esri::ArcGISRuntime::Geometry &geometry, const Esri::ArcGISRuntime::Point &point)

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

    • geometry - A geometry object.
    • point - The point of interest.

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

    If the specified geometry is a polyline or polygon, the nearest vertex is the closest ending position of the line segment that comprises the geometry. It may not necessarily be the closest point of the line segment. If you want to obtain the closest point in the polyline or polygon use nearestCoordinate(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::Point&).

    Input geometries with true curves (where Geometry::hasCurves is true) are supported, although curve segments do not affect the return value.

    [static] Esri::ArcGISRuntime::Geometry GeometryEngine::normalizeCentralMeridian(const Esri::ArcGISRuntime::Geometry &geometry)

    Normalizes the input geometry so that it does not intersect the antimeridian. This may be necessary when wrap around is enabled on the map.

    • geometry - A geometry object.

    Normalization is used when a geometry intersects the minimum or maximum meridian of the spatial reference, or when the geometry is completely outside of the meridian range. You may wish to use this method to normalize geometries before passing them to methods that require coordinates within the spatial reference domain, for example geodatabase editing methods or geocoding services.

    Use this method when editing geometries on a map that has wraparound enabled. For example, if you pan west across the dateline several times and then add new features to a map, the coordinates of the newly added features would correspond to the frame of the map and be incorrectly outside of the spatial reference's maximum extent. Use this method to normalize the geometry coordinates into the correct range.

    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.

    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.

    Supports true curves.

    [static] Esri::ArcGISRuntime::Geometry GeometryEngine::offset(const Esri::ArcGISRuntime::Geometry &geometry, double distance, Esri::ArcGISRuntime::GeometryOffsetType offsetType, double bevelRatio, double flattenError)

    Returns an offset version of the input geometry.

    • geometry - A geometry object.
    • distance - The offset distance for the new geometry.
    • offsetType - The offset type 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 the offset type if round).

    The offset operation creates a geometry that is a constant distance from the input geometry. It 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. For a simple polygon, the orientation of outer rings is clockwise and for inner rings it is counterclockwise. 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.

    [static] bool GeometryEngine::overlaps(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)

    Returns a bool that tests if two geometries overlap.

    • geometry1 - A geometry object.
    • geometry2 - Another geometry object.

    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, the 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.

    This spatial relationship test is based on the Dimensionally Extended 9 Intersection Model (DE-9IM) developed by Clementini, et al., and is discussed further in the web pages: DE-9IM and Spatial relationships.

    Supports true curves.

    [static] Esri::ArcGISRuntime::Geometry GeometryEngine::project(const Esri::ArcGISRuntime::Geometry &geometry, const Esri::ArcGISRuntime::SpatialReference &spatialReference)

    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 project(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::SpatialReference&, Esri::ArcGISRuntime::DatumTransformation*) overload.

    If the geometry parameter has z-values, those z-values are also transformed as long as both the SpatialReference of that geometry and the spatialReference parameter have a vertical coordinate system.

    Supports true curves. Projecting curves located at poles and coordinate system horizons using ArcGIS Maps API may give results that differ slightly from other ArcGIS software. This is because it uses a different geometry projection function.

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

    Returns the geometry projected into the given SpatialReference. If the input geometry has no SpatialReference, no projection occurs; instead, an identical geometry with the given SpatialReference is returned.

    [static, since Esri::ArcGISRuntime 100.2] Esri::ArcGISRuntime::Geometry GeometryEngine::project(const Esri::ArcGISRuntime::Geometry &geometry, const Esri::ArcGISRuntime::SpatialReference &spatialReference, Esri::ArcGISRuntime::DatumTransformation *datumTransformation)

    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 output spatialReference involves a change of datum, and you do not wish to use the default datum transformation used by project(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::SpatialReference&).

    If the input geometry has a null SpatialReference, no projection occurs; instead, an identical geometry with the given SpatialReference is returned.

    Supports true curves. Projecting curves located at poles and coordinate system horizons using ArcGIS Maps SDK may give results that differ slightly from other ArcGIS software because ArcGIS Maps SDK uses a different geometry projection function.

    • geometry - A geometry object.
    • spatialReference - The spatial reference system to project to.
    • datumTransformation - The datum transformation that describes how coordinates are converted from one coordinate system to another. Using a HorizontalVerticalTransformation here also transforms the z-values of the geometry, if the geometry parameter has z-values, and both the SpatialReference of the geometry parameter, and the output SpatialReference, have a vertical coordinate system set.

    This function was introduced in Esri::ArcGISRuntime 100.2.

    [static] bool GeometryEngine::relate(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2, const QString &relation)

    Returns a bool that tests if the two geometries are related using a custom relation.

    • geometry1 - A geometry object.
    • geometry2 - Another geometry object.
    • relation - The DE-9IM string to be evaluated. This must be nine characters long and only contain the characters TF*012.

    You can test for a custom spatial relationship by defining your own relation. For example, you can create a relation that tests if two geometries intersect and touch.

    The Dimensionally Extended 9 Intersection Model (DE-9IM) matrix relation (encoded as a string) is a custom spatial relationship type used to test the relationship of two geometries. See Custom spatial relationships for more information about the DE-9IM model and how the relationship string patterns are constructed.

    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.

    Supports true curves.

    [static, since Esri::ArcGISRuntime 100.1] Esri::ArcGISRuntime::Geometry GeometryEngine::removeM(const Esri::ArcGISRuntime::Geometry &geometry)

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

    • geometry - A geometry.

    If the given geometry has no m-values, the given geometry is returned. The resulting geometry has a Geometry::hasM value of false.

    Supports true curves.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [static, since Esri::ArcGISRuntime 100.1] Esri::ArcGISRuntime::Geometry GeometryEngine::removeZ(const Esri::ArcGISRuntime::Geometry &geometry)

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

    • geometry - A geometry.

    If the given geometry has no z-values, the given geometry is returned. The resulting geometry has a Geometry::hasZ value of false.

    Supports true curves.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [static, since Esri::ArcGISRuntime 100.1] Esri::ArcGISRuntime::Geometry GeometryEngine::removeZAndM(const Esri::ArcGISRuntime::Geometry &geometry)

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

    • geometry - A geometry.

    If the given geometry has no z-coordinates and no m-values, the given geometry is returned. The resulting geometry has both Geometry::hasZ and Geometry::hasM values of false.

    Supports true curves.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [static, since Esri::ArcGISRuntime 100.1] Esri::ArcGISRuntime::Multipart GeometryEngine::reshape(const Esri::ArcGISRuntime::Multipart &geometry, const Esri::ArcGISRuntime::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, since Esri::ArcGISRuntime 200.2] Esri::ArcGISRuntime::Geometry GeometryEngine::rotate(const Esri::ArcGISRuntime::Geometry &geometry, double angle, const Esri::ArcGISRuntime::Point &origin)

    Rotates the geometry by the specified angle of rotation around the provided origin point.

    • geometry - The geometry to rotate.
    • angle - The angle by which to rotate the geometry, counterclockwise, in degrees.
    • origin - The center of rotation. If empty, or Geometry::isEmpty is true, the center of the extent of the given geometry is used.

    The angle of rotation is used in the form of the modulo of 360 degrees; for example rotating by 540 degrees is equivalent to rotating the geometry by 180 degrees. A positive value corresponds to a counterclockwise rotation.

    The GeometryType of the returned geometry is the same as the input geometry, except for an input Envelope which returns a Polygon result.

    If the origin Point has a different SpatialReference to that of the geometry parameter, the point will be reprojected before the geometry is rotated, using the default transformation.

    Rotating a Point using the same location for the origin parameter returns a Point with the same values as the input.

    Supports true curves.

    {move(const Esri::ArcGISRuntime::Geometry&, double, double)}, {Esri::ArcGISRuntime::GeometryEngine::scale(const Esri::ArcGISRuntime::Geometry&, double, double, const Esri::ArcGISRuntime::Point&)} {scale(const Esri::ArcGISRuntime::Geometry&, double, double, const Esri::ArcGISRuntime::Point&)}, {Esri::ArcGISRuntime::GeometryEditor::rotateSelectedElement(double, const Esri::ArcGISRuntime::Point&)} {GeometryEditor::rotateSelectedElement(double, const Esri::ArcGISRuntime::Point&)}

    This function was introduced in Esri::ArcGISRuntime 200.2.

    See also Esri::ArcGISRuntime::GeometryEngine::move(const Esri::ArcGISRuntime::Geometry&, double, double).

    [static, since Esri::ArcGISRuntime 200.2] Esri::ArcGISRuntime::Geometry GeometryEngine::scale(const Esri::ArcGISRuntime::Geometry &geometry, double scaleX, double scaleY, const Esri::ArcGISRuntime::Point &origin)

    Scales the given geometry by the specified factors from the specified origin point.

    • geometry - The geometry to scale.
    • scaleX - The scale factor along the x-axis. It can be positive or negative. It cannot be a non-numeric value.
    • scaleY - The scale factor along the y-axis. It can be positive or negative. It cannot be a non-numeric value.
    • origin - The point around which the geometry will be scaled. If empty, or Geometry::isEmpty is true, the center of the extent of the geometry parameter is used.

    If the origin Point has a different SpatialReference than that of the geometry parameter, the point will be reprojected before the geometry is scaled, using the default transformation.

    Scaling a Point using the same location for the origin parameter returns a Point with the same values as the input.

    Positive scale factors greater than 1 increase the size of the GeometryEditor::geometry, and positive factors between 0 and 1 reduce the size of the geometry. 0 or negative scale factors produce a geometry reflected across the axes of the origin point. Negative factors less than -1 both reflect and increase the size of the geometry, and negative factors between -1 and 0 both reflect and reduce the size of the geometry. Scale factors of -1 reflect the geometry across the axes of the origin point without changing the size.

    Supports true curves.

    {move(const Esri::ArcGISRuntime::Geometry&, double, double)}, {Esri::ArcGISRuntime::GeometryEngine::rotate(const Esri::ArcGISRuntime::Geometry&, double, const Esri::ArcGISRuntime::Point&)} {rotate(const Esri::ArcGISRuntime::Geometry&, double, const Esri::ArcGISRuntime::Point&)}, {Esri::ArcGISRuntime::GeometryEditor::scaleSelectedElement(double, double, const Esri::ArcGISRuntime::Point&)} {GeometryEditor::scaleSelectedElement(double, double, const Esri::ArcGISRuntime::Point&)}

    This function was introduced in Esri::ArcGISRuntime 200.2.

    See also Esri::ArcGISRuntime::GeometryEngine::move(const Esri::ArcGISRuntime::Geometry&, double, double).

    [static] Esri::ArcGISRuntime::Geometry GeometryEngine::sectorGeodesic(const Esri::ArcGISRuntime::GeodesicSectorParameters &parameters)

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

    Creates 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.

    The new geometry consists of a series of LineSegment objects.

    See also GeodesicSectorParameters.

    [static, since Esri::ArcGISRuntime 100.1] Esri::ArcGISRuntime::Geometry GeometryEngine::setM(const Esri::ArcGISRuntime::Geometry &geometry, double m)

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

    • geometry - A geometry.
    • m - The 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 a Geometry::hasM value of true.

    Supports true curves.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [static, since Esri::ArcGISRuntime 100.1] Esri::ArcGISRuntime::Geometry GeometryEngine::setZ(const Esri::ArcGISRuntime::Geometry &geometry, double z)

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

    • geometry - A geometry.
    • z - The z-coordinate.

    If the given geometry already has z-coordinates, they are replaced within the resulting geometry by the supplied z-value. The resulting geometry has a Geometry::hasZ value of true.

    Supports true curves.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [static, since Esri::ArcGISRuntime 100.1] Esri::ArcGISRuntime::Geometry GeometryEngine::setZAndM(const Esri::ArcGISRuntime::Geometry &geometry, double z, double m)

    Returns a copy of a geometry with the supplied z-coordinate and m-value.

    • geometry - A geometry.
    • z - The z-coordinate.
    • m - The 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::hasZ and Geometry::hasM values of true.

    Supports true curves.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [static] Esri::ArcGISRuntime::Geometry GeometryEngine::simplify(const Esri::ArcGISRuntime::Geometry &geometry)

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

    • geometry - A geometry object.

    This method rectifies polygons that may be self-intersecting or contain incorrect ring orientations.

    Geometries must be topologically correct to perform topological operations. Polygons that are self-intersecting or that have inconsistent ring orientations may produce inaccurate results. To ensure that polygons constructed or modified programmatically are topologically consistent it's best to simplify their geometry using this method. Geometries returned by ArcGIS Server services are always topologically correct.

    Supports true curves.

    [static] Esri::ArcGISRuntime::Geometry GeometryEngine::symmetricDifference(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)

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

    • geometry1 - A geometry object.
    • geometry2 - Another geometry object.

    Symmetric difference obtains those parts of the two input geometries that do not overlap. If you want to perform a more atomic-level difference operation where the spatial subtraction of two input geometries might look different if the order of the geometries were switched, consider using difference(const Esri::ArcGISRuntime::Geometry&, const Esri::ArcGISRuntime::Geometry&).

    Supports true curves.

    [static] bool GeometryEngine::touches(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)

    Returns a bool that tests if the two geometries have at least one boundary point in common, but no interior points.

    • geometry1 - A geometry object.
    • geometry2 - Another geometry object.

    This spatial relationship test is based on the Dimensionally Extended 9 Intersection Model (DE-9IM) developed by Clementini, et al., and is discussed further in the web pages: DE-9IM and Spatial relationships.

    Supports true curves.

    [static] Esri::ArcGISRuntime::Geometry GeometryEngine::unionOf(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)

    Returns the union of the two geometries.

    • geometry1 - A geometry object.
    • geometry2 - Another geometry object.

    The union combines those parts of the two geometries which overlap into a single geometry.

    Returns all parts of the two input geometries combined into a single geometry. The order of the input parameters is irrelevant. If the two geometries have different dimensionality, the geometry with the higher dimensionality is returned. For example, a polygon is returned if the given geometries are Polygon and Point.

    Supports true curves.

    [static, since Esri::ArcGISRuntime 100.1] Esri::ArcGISRuntime::Geometry GeometryEngine::unionOf(const QList<Esri::ArcGISRuntime::Geometry> &geometries)

    Returns the union of the geometries in the list.

    • geometries - A collection of geometries.

    The union combines those parts of the input geometries which overlap into a single geometry.

    If the list contains geometries of differing dimensionality, the geometry with the higher dimensionality is returned. For example, a polygon is returned if the given a list contains polygons, polylines, and points.

    Supports true curves.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [static] bool GeometryEngine::within(const Esri::ArcGISRuntime::Geometry &geometry1, const Esri::ArcGISRuntime::Geometry &geometry2)

    Returns a bool that tests if geometry1 is within geometry2.

    • geometry1 - A geometry object.
    • geometry2 - Another geometry object.

    Returns true if geometry1 lies in the interior of geometry2. The boundary and interior of the geometry1 is not allowed to intersect the exterior of the geometry2 and the geometry1 may not equal the geometry2.

    This spatial relationship test is based on the Dimensionally Extended 9 Intersection Model (DE-9IM) developed by Clementini, et al., and is discussed further in the web pages: DE-9IM and Spatial relationships.

    Supports true curves.

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.