ArcGIS Runtime SDK for iOS: AGSGeometry Class Reference
ArcGIS Runtime SDK for iOS  100.11
AGSGeometry Class Reference

Description

Base class for all classes that represent geometric shapes.

AGSGeometry is the base class for two-dimensional (x,y) or three-dimensional (x,y,z) geometries. Objects that inherit from the AGSGeometry class may also include a measure (m-value) for each vertex. The AGSGeometry class provides functionality common to all types of geometry. AGSPoint, AGSMultipoint, AGSPolyline, AGSPolygon, and AGSEnvelope all inherit from AGSGeometry and represent different types of shapes.

AGSGeometry represents real-world objects by defining a shape at a specific geographic location. It is used throughout the API to represent the shapes of features and graphics, layer extents, viewpoints, and GPS locations. It is also used, for example, to define inputs and outputs for spatial analysis and geoprocessing operations and to measure distances and areas.

All types of geometry:

  • Have an AGSSpatialReference indicating the coordinate system used by its coordinates
  • Can be empty, indicating that they have no specific location or shape
  • May have z-values and/or m-values to define elevation and measures respectively
  • Can be converted to and from JSON to be persisted or to be exchanged directly with REST services

Immutability:

Most geometries are created and not changed for their lifetime. 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. Immutable geometries (geometries that cannot be changed) offer some important benefits to your app. 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 AGSGeometryBuilder (for example, AGSPolygonBuilder), which can represent the state of a geometry under construction while allowing modifications, thus enabling editing workflows.

Additionally, AGSGeometryEngine 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.

Coordinate units:

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

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

Spatial reference and projection:

Changing the coordinates of a geometry to have the same shape and location represented using a different AGSSpatialReference 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.

See also
AGSGeometryEngine for performing operations on geometries
AGSGeometryBuilder for constructing or modifying geometries
Since
100
Inheritance diagram for AGSGeometry:
AGSObject <AGSJSONSerializable> AGSEnvelope AGSMultipart AGSMultipoint AGSPoint AGSPolygon AGSPolyline

Instance Methods

(BOOL) - isEqualToGeometry:
 
(BOOL) - isEqualToGeometry:tolerance:
 
(AGSGeometryBuilder *) - toBuilder
 
(nullable id) - toJSON:
 

Class Methods

(nullable id< AGSJSONSerializable >) + fromJSON:error:
 

Properties

AGSGeometryDimension dimension
 
BOOL empty
 
AGSEnvelopeextent
 
AGSGeometryType geometryType
 
BOOL hasCurves
 
BOOL hasM
 
BOOL hasZ
 
AGSSpatialReferencespatialReference
 
NSDictionary< NSString *, id > * unknownJSON
 
NSDictionary< NSString *, id > * unsupportedJSON
 

Method Documentation

◆ fromJSON:error:

+ (nullable id<AGSJSONSerializable>) fromJSON: (id)  JSONObject
error: (NSError **)  error 
staticrequiredinherited

Initializes and returns an object from its JSON representation.

Parameters
JSONObjectNSDictionary or NSArray containing the JSON.
errorencountered during the operation, if any.
Since
100

◆ isEqualToGeometry:

- (BOOL) isEqualToGeometry: (AGSGeometry *)  other

Compares whether two geometries are equal.

Parameters
otherThe other geometry object to compare this geometry object to.
Returns
YES if the geometries are equal.
Since
100

◆ isEqualToGeometry:tolerance:

- (BOOL) isEqualToGeometry: (AGSGeometry *)  other
tolerance: (double)  tolerance 

Compares two geometry objects for equality to within some tolerance.

Parameters
otherThe other geometry object to compare this geometry object to.
toleranceThe tolerance.
Returns
YES if the geometries are equal within the given tolerance, otherwise NO.
Since
100

◆ toBuilder

- (AGSGeometryBuilder*) toBuilder

Returns a builder using a copy of this geometry as a starting off point. The builder can be used to make modifications to the geometry.

Returns
A builder object.
Since
100
Note
Any changes you make using the builder modifies its own internal copy of the geometry. It does not affect this geometry.

Implemented in AGSPolyline, AGSPolygon, AGSPoint, AGSMultipoint, and AGSEnvelope.

◆ toJSON:

- (nullable id) toJSON: (NSError **)  error
requiredinherited

Returns JSON representation for this object.

Parameters
errorencountered during the operation, if any.
Returns
NSDictionary or NSArray containing the JSON.
Since
100

Reimplemented in AGSPortalItem.

Property Documentation

◆ dimension

- (AGSGeometryDimension) dimension
readnonatomicassign

The dimension of this geometry object.

Note
Will return AGSGeometryDimension::AGSGeometryDimensionUnknown if an error occurs.
Since
100

◆ empty

- (BOOL) empty
readnonatomicassign

Indicates whether this geometry has any vertices.

Since
100

◆ extent

- (AGSEnvelope*) extent
readnonatomicstrong

Smallest, rectangular bounding-box that covers the geometry.

Since
100

◆ geometryType

- (AGSGeometryType) geometryType
readnonatomicassign

The type of this geometry.

Since
100

◆ hasCurves

- (BOOL) hasCurves
readnonatomicassign

Indicates whether this geometry has curves.

Since
100

◆ hasM

- (BOOL) hasM
readnonatomicassign

Indicates whether this geometry contains m (measure) values.

Since
100

◆ hasZ

- (BOOL) hasZ
readnonatomicassign

Indicates whether this geometry contains z coordinate values. Only 3D geometries contain z values.

Since
100

◆ spatialReference

- (AGSSpatialReference*) spatialReference
readnonatomicstrong

The spatial reference associated with the gometry. It specifies the coordinate system for the geometry's x, y, and z coordinate values.

Since
100
Note
Geometries that represent geographic locations should always have a spatial reference. Otherwise the coordinates of the geometry are meaningless.

◆ unknownJSON

- (NSDictionary<NSString*,id>*) unknownJSON
readrequirednonatomiccopyinherited

A dictionary of values that was in the source JSON but was unparsed by API.

Returns
NSDictionary containing the unknown JSON.
Since
100

◆ unsupportedJSON

- (NSDictionary<NSString*,id>*) unsupportedJSON
readnonatomiccopyinherited

A dictionary of values that are supported by the REST API, but not exposed through the SDK API.

Returns
NSDictionary containing the unsupported JSON.
Since
100