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

Description

Defines common members for all specific types of geometry.

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.

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.

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.

On the surface, immutability may appear to present a problem when attempting to edit existing geometries. Creating and updating, however, is handled by the various types of AGSGeometryBuilder, which are designed to represent the state of a geometry under construction while allowing modifications, thus enabling editing workflows.

Spatial reference and projection 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. An AGSGraphic that does not have a spatial reference is drawn using the same spatial reference as the AGSMapView to which it was added. When using AGSGeometryBuilder to create an AGSPolyline or AGSPolygon from a collection of AGSPoint, you don't need to set the spatial reference of every point before you add it to the builder, 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, AGSGeometry::spatialReference must be set.

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.

AGSGeometryEngine, 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 AGSGeometryEngine::projectWithGeometry:spatialReference:, AGSGeometryEngine::moveGeodeticWithPointCollection:distance:distanceUnit:azimuth:azimuthUnit:curveType:, AGSGeometryEngine::cutWithGeometry:cutter:, AGSGeometryEngine::densifyWithGeometry:maxSegmentLength:, and AGSGeometryEngine::generalizeWithGeometry:maxDeviation:removeDegenerateParts: geometries.

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
othergeometry to compare this geometry to
Returns
YES if the geometries are equal
Since
100

§ isEqualToGeometry:tolerance:()

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

§ 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
builder
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 AGSEnvelope, AGSPoint, AGSPolyline, AGSMultipoint, and AGSPolygon.

§ 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

§ 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