Skip To Content ArcGIS for Developers Sign In Dashboard

Geometry QML Type

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

Import Statement: import Esri.ArcGISRuntime 100.9
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 as it will be 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. The 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 has curves (read-only).


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(other)

Returns true if this geometry is equivalent with other.


bool equalsWithTolerance(other, double tolerance)

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



Feedback on this topic?