AGSSpatialReference Class Reference
Description
Instances of this class represent a spatial reference. 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. More information about spatial references and coordinate systems is available here.
It is very important to associate spatial data, such as geometry objects, with corresponding spatial references.
 - Defined in:
 -   AGSGeometry.h  ( ArcGIS library) 
 
 - Since:
 - 1.0 
 
List of all members.
Member Function Documentation
      
        
          | - (double) convertValue:  | 
           | 
          (double)  | 
           val | 
        
        
          | fromUnit: | 
           | 
          (AGSSRUnit)  | 
           fromUnit |   | 
        
        
           | 
           | 
           |  |  | 
        
      
 
Converts the value from a specified unit to the same unit as the current spatial reference. Will return nan if trying to convert between angular and linear units, for example, Decimal Degrees and Meters. 
- Parameters:
 - 
  
     | val  | The value to convert.  | 
     | fromUnit  | The unit to convert from.  | 
  
   
- Returns:
 - The converted value. 
 
- Since:
 - 1.8 
 
 
 
      
        
          | - (double) convertValue:  | 
           | 
          (double)  | 
           val | 
        
        
          | toUnit: | 
           | 
          (AGSSRUnit)  | 
           unit |   | 
        
        
           | 
           | 
           |  |  | 
        
      
 
Converts the value in the same unit as the current spatial reference to a specified unit. Will return nan if trying to convert between angular and linear units, for example, Decimal Degrees and Meters. 
- Parameters:
 - 
  
     | val  | The value to convert.  | 
     | unit  | The unit to convert to.  | 
  
   
- Returns:
 - The converted value. 
 
- Since:
 - 1.8 
 
 
 
      
        
          | - (void) decodeWithJSON:  | 
           | 
          (NSDictionary *)  | 
           json | 
            | 
           [optional, inherited] | 
        
      
 
Decode object from JSON representation. 
- Parameters:
 - 
  
     | json  | The JSON representation of the object to be decoded.  | 
  
   
- Since:
 - 1.0 
 
 
 
      
        
          | - (NSDictionary *) encodeToJSON  | 
           | 
           | 
            | 
           [optional, inherited] | 
        
      
 
Encode and return JSON representation for object. 
- Returns:
 - JSON representation of object. 
 
- Since:
 - 1.0 
 
 
 
      
        
          | - (void) encodeToJSON:  | 
           | 
          (NSMutableDictionary*)  | 
           json | 
        
        
          | forKey: | 
           | 
          (NSString*)  | 
           key |   | 
        
        
           | 
           | 
           |  |  | 
        
      
 
Encodes spatial reference to json conditionally based on existence of a wkt 
- Parameters:
 - 
  
     | json  | The dictionary to encode spatial reference to.  | 
     | key  | The encoded spatial reference is paired with.  | 
  
   
- Since:
 - 1.0 
 
 
 
      
        
          | - (id) initWithJSON:  | 
           | 
          (NSDictionary *)  | 
           json | 
            | 
           [optional, inherited] | 
        
      
 
Initialize and return object from JSON representation. 
- Parameters:
 - 
  
     | json  | The JSON representation of the object to be created.  | 
  
   
- Returns:
 - Object decoded from JSON representation. 
 
- Since:
 - 1.0 
 
 
 
      
        
          | - (id) initWithWKID:  | 
           | 
          (NSUInteger)  | 
           wkid | 
            | 
           | 
        
      
 
Initialize a spatial reference with wkid. 
- Parameters:
 - 
  
     | wkid  | The well-known ID to initialize the spatial reference with.  | 
  
   
- Since:
 - 1.0 
 
 
 
      
        
          | - (id) initWithWKID:  | 
           | 
          (NSUInteger)  | 
           wkid | 
        
        
          | WKT: | 
           | 
          (NSString *)  | 
           wkt |   | 
        
        
           | 
           | 
           |  |  | 
        
      
 
Initialize spatial reference with well-known ID and text. This is the designated initializer. 
- Parameters:
 - 
  
     | wkid  | The well-known ID.  | 
     | wkt  | The well-known text.  | 
  
   
- Returns:
 - A new spatial reference object. 
 
- Since:
 - 1.0 
 
 
 
      
        
          | - (id) initWithWKT:  | 
           | 
          (NSString *)  | 
           wkt | 
            | 
           | 
        
      
 
Initialize a spatial reference with wkt. 
- Parameters:
 - 
  
     | wkt  | The well-known text to initialize the spatial reference with.  | 
  
   
- Since:
 - 1.0 
 
 
 
      
        
          | - (BOOL) isAnyWebMercator  | 
           | 
           | 
            | 
           | 
        
      
 
Returns YES if wkid equals any of the "web mercator" projections. 
- Since:
 - 1.0 
 
 
 
Returns YES if spatial references are both web mercator. If not, it will return YES if wkid or wkt are equal. 
- Since:
 - 1.0 
 
 
 
Returns YES if wkid equals 4326. 
- Since:
 - 1.0 
 
 
 
      
        
          | + (id) spatialReferenceWithWKID:  | 
           | 
          (NSUInteger)  | 
           wkid | 
            | 
           | 
        
      
 
Initialize an autoreleased spatial reference with wkid. 
- Parameters:
 - 
  
     | wkid  | The well-known ID to initialize the spatial reference with.  | 
  
   
- Since:
 - 1.0 
 
 
 
      
        
          | + (id) spatialReferenceWithWKID:  | 
           | 
          (NSUInteger)  | 
           wkid | 
        
        
          | WKT: | 
           | 
          (NSString *)  | 
           wkt |   | 
        
        
           | 
           | 
           |  |  | 
        
      
 
Create new autoreleased spatial reference object. 
- Parameters:
 - 
  
     | wkid  | The well-known ID.  | 
     | wkt  | The well-known text.  | 
  
   
- Returns:
 - A new spatial reference object. 
 
- Since:
 - 1.0 
 
 
 
      
        
          | + (id) spatialReferenceWithWKT:  | 
           | 
          (NSString *)  | 
           wkt | 
            | 
           | 
        
      
 
Initialize an autoreleased spatial reference with wkt. 
- Parameters:
 - 
  
     | wkt  | The well-known text to initialize the spatial reference with.  | 
  
   
- Since:
 - 1.0 
 
 
 
The units that the spatial reference coordinates are in. 
- Since:
 - 1.8 
 
 
 
Returns a spatial reference object in web mercator. 
- Since:
 - 1.8 
 
 
 
Returns a spatial reference object in WGS84 (4326). 
- Since:
 - 1.8 
 
 
 
Property Documentation
      
        
          - (NSUInteger) wkid [read, assign] | 
        
      
 
The well-known ID of the spatial reference. 
- Since:
 - 1.0 
 
 
 
      
        
          - (NSString*) wkt [read, copy] | 
        
      
 
The well-known text of the spatial reference.  
- Availability:
 -   This feature is only available with services from ArcGIS Server  10.0   or above  
 
 - Since:
 - 1.0