public class

SpatialReference

extends Object
implements Serializable
java.lang.Object
   ↳ com.esri.core.geometry.SpatialReference

Class Overview

An abstract class that represents the spatial reference of a geometry. SpatialReference instances are immutable.

Summary

Nested Classes
enum SpatialReference.Type The spatial reference type can be local, geographic, or projected. 
Fields
public static int WKID_WGS84 The WKID for WGS 84.
public static int WKID_WGS84_WEB_MERCATOR The WKID for WGS 1984 Web Mercator (102113).
public static int WKID_WGS84_WEB_MERCATOR_AUXILIARY_SPHERE The WKID for WGS 1984 Web Mercator Auxiliary Sphere (102100).
public static int WKID_WGS84_WEB_MERCATOR_AUXILIARY_SPHERE_10 The WKID for WGS 1984 Web Mercator Auxiliary Sphere starting at ArcGIS 10.0.
Protected Constructors
SpatialReference()
Creates an empty Spatial Reference
SpatialReference(int wkid)
Public Methods
static SpatialReference create(int wkid)
Creates an instance of the spatial reference based on the provided well-known ID for the horizontal coordinate system.
static SpatialReference create(String wktext)
Creates an instance of the spatial reference based on the provided well-known text representation for the horizontal coordinate system.
static SpatialReference createLocal()
Creates a local spatial reference.
static SpatialReference createLocal(Unit unit)
Creates a local spatial reference.
boolean equals(Object obj)
Compare two spatial reference instances and return whether or not they are equal.
static SpatialReference fromJson(JsonParser parser)
Creates a SpatialReference from a JSON representation.
double getConvergenceAngle(Point point)
Calculates grid convergence angle in radians at a given point.
SpatialReference.Type getCoordinateSystemType()
Returns the map projection type.
SpatialReference getGCS()
Gets the Geographic Coordinate System of the spatial reference.
int getID()
Returns the well-known ID for the horizontal coordinate system of the spatial reference.
int getLatestID()
Returns the most current well-known ID, the Geometry engine knows about, for the horizontal coordinate system.
int getOldID()
Returns the oldest value of the well-known ID for the horizontal coordinate system of the spatial reference.
Envelope getPannableExtent()
Returns the pannable extent.
String getText()
Returns the well-known text for the for the horizontal coordinate system of the spatial reference.
double getTolerance()
Get the XY tolerance of the spatial reference
Unit getUnit()
Returns the unit of a spatial reference.
boolean isAnyWebMercator()
Returns true/false if the spatial reference is a web mercator projection.
boolean isWGS84()
Returns true/false if the spatial reference is 4326 / WGS84.
String toJson()
String toString()
Returns a string representation of the class for debugging purposes.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

public static int WKID_WGS84

The WKID for WGS 84.

public static int WKID_WGS84_WEB_MERCATOR

The WKID for WGS 1984 Web Mercator (102113). It was added at 9.3

public static int WKID_WGS84_WEB_MERCATOR_AUXILIARY_SPHERE

The WKID for WGS 1984 Web Mercator Auxiliary Sphere (102100).

public static int WKID_WGS84_WEB_MERCATOR_AUXILIARY_SPHERE_10

The WKID for WGS 1984 Web Mercator Auxiliary Sphere starting at ArcGIS 10.0.

Protected Constructors

protected SpatialReference ()

Creates an empty Spatial Reference

protected SpatialReference (int wkid)

Parameters
wkid int

Public Methods

public static SpatialReference create (int wkid)

Creates an instance of the spatial reference based on the provided well-known ID for the horizontal coordinate system.

Parameters
wkid int: The well-known ID.
Returns
SpatialReference SpatialReference The spatial reference.
Throws
IllegalArgumentException if wkid is not supported or does not exist.

public static SpatialReference create (String wktext)

Creates an instance of the spatial reference based on the provided well-known text representation for the horizontal coordinate system.

Parameters
wktext String: The well-known text string representation of spatial reference.
Returns
SpatialReference SpatialReference The spatial reference.

public static SpatialReference createLocal ()

Creates a local spatial reference. A local spatial reference is not associated with any map coordinate system.

Returns
SpatialReference SpatialReference The spatial reference.

public static SpatialReference createLocal (Unit unit)

Creates a local spatial reference. A local spatial reference is not associated with any map coordinate system.

Parameters
unit Unit: The unit of the local coordinate system.
Returns
SpatialReference SpatialReference The spatial reference.

public boolean equals (Object obj)

Compare two spatial reference instances and return whether or not they are equal. Spatial references are considered to be equal when one of the following applies:

  • They both have the same WKID
  • They both have WKIDs for a web mercator variant
  • They both have the same WKT

    Parameters
    obj Object
    Returns
    boolean True if the given spatial reference matches this one, false otherwise
  • public static SpatialReference fromJson (JsonParser parser)

    Creates a SpatialReference from a JSON representation.

    Parameters
    parser JsonParser: The JSON parser.
    Returns
    SpatialReference The spatial reference or null if there is no spatial reference information, or the parser does not point to an object start.
    Throws
    Exception if parsing has failed

    public double getConvergenceAngle (Point point)

    Calculates grid convergence angle in radians at a given point. This angle is the rotation angle of the true north clockwise positive from the grid north. The angle is the direction of the meridional line (true north) clockwise positive from grid north. If this method is called when using a geographic spatial reference, the returned angle returned will always be 0.

    Parameters
    point Point: The location for which the convergence angle will be calculated within the spatial reference.
    Returns
    double angle in radians

    public SpatialReference.Type getCoordinateSystemType ()

    Returns the map projection type.

    Returns
    SpatialReference.Type Map Projection Type

    public SpatialReference getGCS ()

    Gets the Geographic Coordinate System of the spatial reference.

    Returns
    SpatialReference The geographic coordinate system of the spatial reference.

    public int getID ()

    Returns the well-known ID for the horizontal coordinate system of the spatial reference.

    Returns
    int wkid The well-known ID.

    public int getLatestID ()

    Returns the most current well-known ID, the Geometry engine knows about, for the horizontal coordinate system.

    Returns
    int

    public int getOldID ()

    Returns the oldest value of the well-known ID for the horizontal coordinate system of the spatial reference. This ID is used for JSON serialization.

    Returns
    int

    public Envelope getPannableExtent ()

    Returns the pannable extent.

    Returns
    Envelope Envelope object.

    public String getText ()

    Returns the well-known text for the for the horizontal coordinate system of the spatial reference.

    Returns
    String

    public double getTolerance ()

    Get the XY tolerance of the spatial reference

    Returns
    double The XY tolerance of the spatial reference as double.

    public Unit getUnit ()

    Returns the unit of a spatial reference.

    Returns
    Unit The spatial reference unit.

    public boolean isAnyWebMercator ()

    Returns true/false if the spatial reference is a web mercator projection.

    Returns
    boolean boolean

    public boolean isWGS84 ()

    Returns true/false if the spatial reference is 4326 / WGS84.

    Returns
    boolean true if the spatial reference is 4326, false otherwise

    public String toJson ()

    Returns
    String JSON string representation of this spatial reference.

    public String toString ()

    Returns a string representation of the class for debugging purposes. The format and content of the returned string is not part of the contract of the method and is subject to change in any future release or patch without further notice.

    Returns
    String