 All Implemented Interfaces:
JsonSerializable
Instances of this class represent a specific coordinate system identified by a wellknown ID (WKID) number or wellknown text (WKT) string. There are two broad classes of coordinate systems:
 Geographic coordinate systems use a 3dimensional spherical surface to define locations on the earth.
 Projected coordinate systems use a flat, 2dimensional surface.
SpatialReference ensures that you can accurately view, query, and analyze the layers of a GeoModel
.
The spatial reference value is available from a map or scene after loading has completed, and is immutable.
If you want to set this value for a new map or scene, use the ArcGISMap(SpatialReference)
or
ArcGISScene(ArcGISScene.SceneViewTilingScheme)
constructors.
 Since:
 100.0.0
 See Also:

Method Summary
Modifier and TypeMethodDescriptionstatic SpatialReference
create
(int wkid) Creates a new spatial reference from the given wellknown ID (WKID) number.static SpatialReference
create
(int wkid, int verticalWkid) Creates a new spatial reference with the given wellknown ID (WKID) numbers for both a horizontal and a vertical coordinate system.static SpatialReference
Creates a new spatial reference from the given wellknown text (WKT) string.boolean
Tests if this object is equal to a second SpatialReference object.static SpatialReference
Creates a SpatialReference instance from a JSON string.Gets the underlying geographic coordinate system of this spatial reference.double
getConvergenceAngle
(Point point) Gets the calculated grid convergence angle for a given point, which is the angle between True North and Grid North.getUnit()
Gets the units of measurement defined by this instance.SpatialReferences never have any unknown JSON so this returns an empty Map.SpatialReferences never have any unsupported JSON so this returns an empty Map.Gets the unit of measure for the vertical coordinate system of this spatial reference.int
Gets the wellknown ID (WKID) number of the vertical coordinate system of this instance.int
getWkid()
Gets the wellknown ID (WKID) number of this instance.Gets the wellknown text (WKT) representation of this instance.int
hashCode()
Generates a hash value from the SpatialReference.boolean
Indicates if this instance has a vertical coordinate system set.boolean
Indicates if this instance represents a geographic coordinate system.boolean
Indicates if an ArcGISMap with this SpatialReference can be continuously horizontally pannable.boolean
Indicates if this instance represents a projected coordinate system.toJson()
Serializes this object to a JSON string.

Method Details

create
Creates a new spatial reference from the given wellknown ID (WKID) number.The WKID refers to a specific coordinate system. WKIDs are defined by standards bodies or organizations. ArcGIS supports a variety of WKIDs, typically those defined by the European Petroleum Survey Group (EPSG) or Esri, as well as a few other commonly used IDs.
SpatialReferences can also be created from a wellknown text (WKT) string using
create(String)
. Alternatively, use the static methods onSpatialReferences
to return instances of the most commonlyused SpatialReferences. Parameters:
wkid
 the WKID number of the required SpatialReference Returns:
 a SpatialReference with the given WKID number
 Since:
 100.0.0
 See Also:

create
Creates a new spatial reference from the given wellknown text (WKT) string.WKTs are fulltext definitions of all of the parameters that specify a spatial reference.
SpatialReferences can also be created from a wellknown ID (WKID number) string using
create(int)
. Alternatively, use the static methods onSpatialReferences
to return instances of the most commonlyused SpatialReferences. Parameters:
wkText
 a string containing a wellknown text representation of a SpatialReference Returns:
 a SpatialReference based on the given WKT string
 Since:
 100.0.0
 See Also:

create
Creates a new spatial reference with the given wellknown ID (WKID) numbers for both a horizontal and a vertical coordinate system. Vertical coordinate systems are not spatial references themselves, but control how z values are displayed. Parameters:
wkid
 the WKID number of the required horizontal SpatialReferenceverticalWkid
 the WKID number of the required vertical SpatialReference Returns:
 a SpatialReference with the given WKID numbers
 Since:
 100.0.0
 See Also:

fromJson
Creates a SpatialReference instance from a JSON string. Parameters:
json
 a JSON string that represents a SpatialReference Returns:
 a SpatialReference instance
 Throws:
IllegalArgumentException
 if json is null or empty Since:
 100.0.0

toJson
Description copied from interface:JsonSerializable
Serializes this object to a JSON string. Note that unknown JSON is omitted from the serialized string. Specified by:
toJson
in interfaceJsonSerializable
 Returns:
 a JSON string

getUnknownJson
SpatialReferences never have any unknown JSON so this returns an empty Map. Specified by:
getUnknownJson
in interfaceJsonSerializable
 Returns:
 an empty unmodifiable Map
 Since:
 100.0.0

getUnsupportedJson
SpatialReferences never have any unsupported JSON so this returns an empty Map. Specified by:
getUnsupportedJson
in interfaceJsonSerializable
 Returns:
 an empty unmodifiable Map
 Since:
 100.0.0

getWkid
public int getWkid()Gets the wellknown ID (WKID) number of this instance. WKIDs are unique numbers that refer to a specific predefined coordinate system. Returns:
 The WKID number of the coordinate system this instance represents. Returns 0 if this instance represents a custom coordinate system, or 1 if it is invalid.
 Since:
 100.0.0
 See Also:

getVerticalUnit
Gets the unit of measure for the vertical coordinate system of this spatial reference.Is null if
hasVertical()
is false. Returns:
 the unit of measure for the vertical coordinate system of this spatial reference, or null if none
 Since:
 100.14.0

getVerticalWkid
public int getVerticalWkid()Gets the wellknown ID (WKID) number of the vertical coordinate system of this instance. WKIDs are unique numbers that refer to a specific predefined coordinate system. Returns:
 The WKID number of the vertical coordinate system this instance represents. Returns 0 if a vertical coordinate system was not set when this instance was created. Returns 1 if an invalid vertical coordinate system was specified.
 Since:
 100.0.0
 See Also:

getBaseGeographic
Gets the underlying geographic coordinate system of this spatial reference. Intended for use when this spatial reference is a projected coordinate system. If this spatial reference is a geographic coordinate system then a new reference to itself is returned. Returns:
 the underlying geographic coordinate system
 Since:
 100.1.0
 See Also:

hasVertical
public boolean hasVertical()Indicates if this instance has a vertical coordinate system set.A spatial reference can optionally include a definition for a vertical coordinate system (VCS), which can be used to interpret the z values of a geometry (
Point.getZ()
). A VCS defines linear units of measure, the origin of z values, and whether z values are "positive up" (representing heights above a surface) or "positive down" (indicating that values are depths below a surface).A
SpatialReference
may have a VCS set, for example if it was created usingcreate(int, int)
.getVerticalWkid()
andgetWKText()
provide more information about the specific VCS set on this instance.VCSs are used when projecting geometries using a
HorizontalVerticalTransformation
. Returns:
 true if this instance has a vertical coordinate system set, false otherwise.
 Since:
 100.9.0
 See Also:

isGeographic
public boolean isGeographic()Indicates if this instance represents a geographic coordinate system. Geographic coordinate systems useangular
units to define coordinates. Returns:
 true if this instance represents a geographic coordinate system, false otherwise
 Since:
 100.0.0
 See Also:

isProjected
public boolean isProjected()Indicates if this instance represents a projected coordinate system. Projected coordinate systems uselinear
units to define coordinates. Returns:
 true if this instance represents a projected coordinate system; false otherwise
 Since:
 100.0.0
 See Also:

isPannable
public boolean isPannable()Indicates if an ArcGISMap with this SpatialReference can be continuously horizontally pannable. A continuously pannable spatial reference is one of the requirements for awraparound map
, where a user is able to continuously pan the map across the antimeridian (approximately equal to the international date line). Only the two most common coordinate systems are continuously pannable; WGS 1984 (WKID 4326), and Web Mercator Auxilliary Sphere (WKID 102113, 102100, or 3857). Returns:
 true if continuously horizontally pannable; false otherwise
 Since:
 100.0.0
 See Also:

getWKText
Gets the wellknown text (WKT) representation of this instance. WKTs are fulltext definitions of all of the parameters that specify a spatial reference.SpatialReferences can be created from a WKT string using
create(String)
. Returns:
 a string containing a WKT representation of this instance
 Since:
 100.0.0

getUnit
Gets the units of measurement defined by this instance. The Unit of the SpatialReference of a Geometry or Layer determine the units used by its coordinates. Returns:
 the units of measurement of this instance
 Since:
 100.0.0
 See Also:

getConvergenceAngle
Gets the calculated grid convergence angle for a given point, which is the angle between True North and Grid North.This value 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.
The grid convergence returned by this method is positive when Grid North lies east of True North, following the GaussBomford convention. The formula
bearing = azimuth  convergence
can be used to obtain a bearing from an azimuth using the grid convergence.This sign convention is sometimes named the GaussBomford 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, its location will be transformed automatically to the given spatial reference
 Parameters:
point
 the point at which to calculate the convergence. If this point has a different spatial reference, it will be reprojected to this spatial reference; if the spatial reference is null, the point is assumed to already be defined in this spatial reference. Returns:
 the convergence angle in degrees. Returns 0 if this spatial reference represents a geographic coordinate
system (
isGeographic()
is true). ReturnsDouble.NaN
if the point lies outside this spatial reference's horizon.  Throws:
IllegalArgumentException
 if point is null Since:
 100.3.0

hashCode
public int hashCode()Generates a hash value from the SpatialReference. 
equals
Tests if this object is equal to a second SpatialReference object.
