Geometry QML Type

Base type for types that represent geometric shapes. More...

Import Statement: import Esri.ArcGISRuntime 100.15
Since: Esri.ArcGISRuntime 100.0
Inherits:

Object

Inherited By:

Envelope, Multipart, Multipoint, and Point

Properties

Signals

Methods

Detailed Description

Note: You cannot declare or create a component of this type in QML code.

Geometry is the base class for two-dimensional (x,y) or three-dimensional (x,y,z) geometries, such as Point and Polyline objects. Objects that inherit from the Geometry class may also include an m (measure) value for each vertex. The Geometry class provides functionality common to all types of geometry; Point, Multipoint, Polyline, Polygon, and Envelope all inherit from Geometry and represent different types of shapes.

Geometries are used throughout the API, for example to define the shape of a feature or graphic, the extent of a layer, or as inputs and outputs of different types of tasks. Geometry examples include features created to be stored in a geodatabase or read from a non-editable layer, and features returned from tasks such as a spatial query, geocode operation, network trace, or geoprocessing task.

This QML type supports the following default properties. A default property may be declared inside another declared object without being assigned explicitly to a property.

TypeDefault Property
SpatialReferencespatialReference

Immutability

All geometries are immutable, which offers important benefits. For example, they are inherently thread-safe, help prevent inadvertent changes, and allow for certain performance optimizations. Instead of changing the properties of existing geometries, you can create and update geometries using the various subclasses of GeometryBuilder (for example, PolygonBuilder), which can represent the state of a geometry under construction while allowing modifications, thus enabling editing workflows.

Additionally, GeometryEngine offers a range of topological and relational operations and spatial transformations that read the content of existing geometries and create new geometries, for example, project, move, scale, rotate, buffer, union, and so on.

Spatial references

The coordinates that define a geometry only have meaning in the context of the Geometry's SpatialReference. The vertices and the spatial reference together allow your app to translate a real-world object from its location on Earth to its location on your map or scene.

In some cases, a geometry's spatial reference may not be set. For example, a Graphic that does not have a spatial reference is drawn using the same spatial reference as the MapView to which it was added. If the coordinates are in a different SpatialReference, the graphics may not display in the correct location, or at all.

When using a GeometryBuilder to create a Polyline or Polygon from a collection of Point, you don't need to set the spatial reference of every point before you add it to the builder, because it is assigned the spatial reference of the builder itself. In most other cases, such as when using a geometry in geometry operations or when editing a feature table, Geometry::spatialReference must be set.

This QML type supports the following default properties. A default property may be declared inside another declared object without being assigned explicitly to a property.

TypeDefault Property
SpatialReferencespatialReference

Spatial reference and projection

Changing the coordinates of a geometry to have the same shape and location represented using a different SpatialReference is known as "projection" or sometimes as "reprojection". Because geometries are immutable, they do not have any member methods that project, transform, or otherwise modify their content.

GeometryEngine, however, provides a wide range of methods that read the content of geometries and modify that content to create new geometries. There are methods to GeometryEngine::project, GeometryEngine::moveGeodetic, GeometryEngine::cut, GeometryEngine::densify, and GeometryEngine::generalize geometries.

Dimension

Every non-empty Geometry has an inherent dimension (sometimes called the topological dimensionality) that indicates the general class of the Geometry.

  • 0 - points and multipoints
  • 1 - lines and polylines
  • 2 - polygons and envelopes
  • 3 - objects with volume

Serializing to JSON

Geometries can be serialized and de-serialized to and from JSON. ArcGIS REST API documentation describes the JSON representation of geometry objects. You can use this encoding and decoding mechanism to exchange geometries with REST Web services or to store them in text files.

Valid polygons have at least three vertices, and valid polylines, two vertices. When there are not enough of them, JSON serialization copies existing vertices to reach the minimum vertex count. This results in invalid (degenerate) geometries that can be parsed as the valid JSON for those geometry types.

See also JsonSerializable, GeometryBuilder, and GeometryEngine.

Property Documentation

dimension : int

Returns the topological dimensionality of this Geometry (read-only).

Every non-empty Geometry has an inherent dimension (sometimes called the topological dimensionality) that indicates the general class of the Geometry.

  • 0 - points and multipoints
  • 1 - lines and polylines
  • 2 - polygons and envelopes
  • 3 - objects with volume

empty : bool

Returns true if this Geometry is empty (read-only).


extent : Envelope

Returns the extent of this Geometry expressed as an Envelope (read-only).


geometryType : Enums.GeometryType

Returns the Enums.GeometryType of this geometry (read-only).


hasCurves : bool

Returns true if this geometry contains curve segments; false otherwise (read-only).

The ArcGIS Platform supports polygon and polyline geometries that contain curve segments (where Segment::isCurve is true, sometimes known as true curves or nonlinear segments). Curves may be present in certain types of data - for example Mobile Map Packages (MMPK) or geometry JSON. When connecting to ArcGIS feature services that support true curves, ArcGIS Runtime retrieves densified versions of curve feature geometries by default

If a polygon or polyline geometry contains curve segments, this property returns true. Prior to Esri::ArcGISRuntime 100.12, it was not possible to access curve segments, and only LineSegment instances would be returned when iterating through the segments in a Polygon or Polyline object, regardless of this property.

From Esri::ArcGISRuntime 100.12, you can use curve segments when using a MultipartBuilder to create or edit polygon and polyline geometries, and also get curve segments when iterating through the segments of existing Multipart geometries when this property returns true.

You can also choose to return true curves from feature services by using ArcGISRuntimeEnvironment::serviceCurveGeometryMode.

See also GeometryBuilder::hasCurves, Part::hasCurves, Segment::isCurve, CubicBezierSegment, and EllipticArcSegment.


hasM : bool

Returns true if the vertices of this Geometry includes z-coordinates (read-only).


hasZ : bool

Returns true if the vertices of this Geometry includes m-values (read-only).


json : jsobject

The JSON representation of this object.


[default] spatialReference : SpatialReference

The spatial reference of this Point.


unknownJson : jsobject

Returns the unknown JSON from the source JSON.

See also JsonSerializable.


unsupportedJson : jsobject

Returns the unsupported data from the source JSON.

See also JsonSerializable.


Signal Documentation

emptyChanged()

Emitted when the empty property changes.

Note: This signal will only be emitted when the property initializes during the instantiation of the component.

Note: The corresponding handler is onEmptyChanged.

This signal was introduced in Esri.ArcGISRuntime 100.4.


extentChanged()

Emitted when the extent property changes.

Note: This signal will only be emitted when the property initializes during the instantiation of the component.

Note: The corresponding handler is onExtentChanged.

This signal was introduced in Esri.ArcGISRuntime 100.4.


hasCurvesChanged()

Emitted when the hasCurves property changes.

Note: This signal will only be emitted when the property initializes during the instantiation of the component.

Note: The corresponding handler is onHasCurvesChanged.

This signal was introduced in Esri.ArcGISRuntime 100.4.


hasMChanged()

Emitted when the hasM property changes.

Note: This signal will only be emitted when the property initializes during the instantiation of the component.

Note: The corresponding handler is onHasMChanged.

This signal was introduced in Esri.ArcGISRuntime 100.4.


hasZChanged()

Emitted when the hasZ property changes.

Note: This signal will only be emitted when the property initializes during the instantiation of the component.

Note: The corresponding handler is onHasZChanged.

This signal was introduced in Esri.ArcGISRuntime 100.4.


spatialReferenceChanged()

Emitted when the spatialReference property changes.

Note: This signal will only be emitted when the property initializes during the instantiation of the component.

Note: The corresponding handler is onSpatialReferenceChanged.

This signal was introduced in Esri.ArcGISRuntime 100.4.


Method Documentation

bool equals(Geometry other)

Returns true if this geometry is equivalent with other.


bool equalsWithTolerance(Geometry other, double tolerance)

Returns true if this geometry is equivalent with other with a tolerance.


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