ArcGIS Runtime SDK for iOS: AGSSpatialReference Class Reference
ArcGIS Runtime SDK for iOS  100.6
AGSSpatialReference Class Reference

Description

A spatial reference determines how map coordinates, or the x,y,z-coordinates in the vertices of geometries, correspond to locations in real-world space. Therefore, it is very important to associate geometries representing spatial data with corresponding spatial references.

Each spatial reference can be represented by either a well-known ID (WKID), or a well-known text (WKT). Spatial references define the spatial properties of a geometry, for instance the coordinate system it uses. There are 2 broad classes of coordinate systems - Geographic & Projected. A Geographic Coordinate system uses a 3-dimensional spherical surface to define locations on the earth. A Projected Coordinate system on the other hand uses a flat, 2-dimensional surface.

Learn more about coordinate systems

Since
100
See also
AGSGeometry for geometry types
+ projectGeometry:toSpatialReference: (AGSGeometryEngine) to project geometries from one spatial reference to another
Inheritance diagram for AGSSpatialReference:
AGSObject <AGSJSONSerializable>

Instance Methods

(double) - convergenceAngleWithPoint:
 
(nullable instancetype) - initWithWKID:
 
(nullable instancetype) - initWithWKID:verticalWKID:
 
(nullable instancetype) - initWithWKText:
 
(BOOL) - isEqualToSpatialReference:
 
(nullable id) - toJSON:
 

Class Methods

(nullable id< AGSJSONSerializable >) + fromJSON:error:
 
(nullable instancetype) + spatialReferenceWithWKID:
 
(nullable instancetype) + spatialReferenceWithWKID:verticalWKID:
 
(nullable instancetype) + spatialReferenceWithWKText:
 
(AGSSpatialReference *) + webMercator
 
(AGSSpatialReference *) + WGS84
 

Properties

AGSSpatialReferencebaseGeographic
 
BOOL geographic
 
BOOL pannable
 
BOOL projected
 
AGSUnitunit
 
NSDictionary< NSString *, id > * unknownJSON
 
NSDictionary< NSString *, id > * unsupportedJSON
 
NSInteger verticalWKID
 
NSInteger WKID
 
NSString * WKText
 

Method Documentation

§ convergenceAngleWithPoint:()

- (double) convergenceAngleWithPoint: (AGSPoint *)  point

Calculate the grid convergence for a spatial reference at a given point.

Remarks The grid convergence is the angle between True North and Grid North at a point on a map. The grid convergence can be used to convert a horizontal direction expressed as an azimuth in a geographic coordinate system (relative to True North) to a direction expressed as a bearing in a projected coordinate system (relative to Grid North), and vice versa.

Sign convention The grid convergence returned by this method is positive when Grid North lies east of True North. The following formula demonstrates how to obtain a bearing (b) from an azimuth (a) using the grid convergence (c) returned by this method: b = a - c This sign convention is sometimes named the Gauss-Bomford convention.

Other Notes

  • Returns 0 if the spatial reference is a geographic coordinate system.
  • Returns NAN if the point is outside the projection's horizon or on error.
  • If the point has no spatial reference, it is assumed to be in the given spatial reference.
  • If the point's spatial reference differs from the spatial reference given, it's location will be transformed automatically to the given spatial reference.
    Parameters
    pointat which to calculate the convergence angle
    Returns
    The grid convergence in degrees.
    Since
    100.3

§ 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

§ initWithWKID:()

- (nullable instancetype) initWithWKID: (NSInteger)  WKID

Initializes a spatial reference with the given well-known ID (WKID).

Parameters
WKIDThe well-known ID
Since
100

§ initWithWKID:verticalWKID:()

- (nullable instancetype) initWithWKID: (NSInteger)  WKID
verticalWKID: (NSInteger)  verticalWKID 

Initializes a spatial reference with the given well-known ID (WKID) and a vertical well-known ID.

Since
100

§ initWithWKText:()

- (nullable instancetype) initWithWKText: (NSString *)  WKText

Initializes a spatial reference with the given well-known text (WKT).

Parameters
WKTextThe well-known text
Since
100

§ isEqualToSpatialReference:()

- (BOOL) isEqualToSpatialReference: (AGSSpatialReference *)  other

Compares whether two spatial references are equal. They are equal if they have the same WKID or #WKT.

Parameters
otherspatial reference to compare this one to
Returns
YES if the spatial references are equal
Since
100

§ spatialReferenceWithWKID:()

+ (nullable instancetype) spatialReferenceWithWKID: (NSInteger)  WKID

Initializes a spatial reference with the given well-known ID (WKID).

Parameters
WKIDThe well-known ID
Since
100

§ spatialReferenceWithWKID:verticalWKID:()

+ (nullable instancetype) spatialReferenceWithWKID: (NSInteger)  WKID
verticalWKID: (NSInteger)  verticalWKID 

Initializes a spatial reference with the given well-known ID (WKID) and a vertical well-known ID.

Since
100

§ spatialReferenceWithWKText:()

+ (nullable instancetype) spatialReferenceWithWKText: (NSString *)  WKText

Initializes a spatial reference with the given well-known text (WKT).

Parameters
WKTextThe well-known text
Since
100

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

§ webMercator()

+ (AGSSpatialReference*) webMercator

A spatial reference representing the Web Mercator coordinate system (WKID:3857, equivalent to WKID:102113)

Since
100

§ WGS84()

+ (AGSSpatialReference*) WGS84

A spatial reference representing the WGS84 coordinate system (WKID:4326)

Since
100

Property Documentation

§ baseGeographic

- (AGSSpatialReference*) baseGeographic
readnonatomicstrong

§ geographic

- (BOOL) geographic
readnonatomicassign

§ pannable

- (BOOL) pannable
readnonatomicassign

§ projected

- (BOOL) projected
readnonatomicassign

§ unit

- (AGSUnit*) unit
readnonatomicstrong

The units of geometry's coordinates for geometries that use this spatial reference.

Since
100

§ 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

§ verticalWKID

- (NSInteger) verticalWKID
readnonatomicassign

§ WKID

- (NSInteger) WKID
readnonatomicassign

The well-known ID of the spatial reference.

Since
100

§ WKText

- (NSString*) WKText
readnonatomiccopy

The well-known text of the spatial reference.

Since
100