public class

SpatialReference

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

Class Overview

An abstract class that represent the spatial reference for the geometry. SpatialReference classes 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.
Public Constructors
SpatialReference(String wktext)
Protected Constructors
SpatialReference()
Creates an empty Spatial Reference
SpatialReference(int wkid)
Public Methods
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 create(int wkid)
Creates an instance of the spatial reference based on the provided well known ID for the horizontal coordinate system.
static SpatialReference createLocal(Unit unit)
Creates a local spatial reference.
static SpatialReference createLocal()
Creates a local spatial reference.
static SpatialReference fromJson(JsonParser parser)
Returns spatial reference from JsonParser.
Point[] fromMilitaryGrid(String[] mgrsStrings, int mgrsConversionMode)
Converts Military Grid strings into coordinates.
SpatialReference.Type getCoordinateSystemType()
Returns map projection type.
SpatialReference getGCS()
Get 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 from a spatial reference
boolean isAnyWebMercator()
Returns true/false if the spatial reference is web mercator projection.
boolean isWGS84()
Returns true/false if the spatial reference is 4326.
String[] toMilitaryGrid(int mgrsConversionMode, int numOfDigits, boolean rounding, boolean addSpaces, Point[] coordinates)
Converts a list of coordinates into military grid strings.
[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.

Public Constructors

public SpatialReference (String wktext)

Protected Constructors

protected SpatialReference ()

Creates an empty Spatial Reference

protected SpatialReference (int wkid)

Public Methods

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 The well-known text string representation of spatial reference.
Returns
  • SpatialReference The spatial reference.

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 The well know ID.
Returns
  • SpatialReference The spatial reference.
Throws
IllegalArgumentException if wkid is not supported or does not exist.

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 The unit of the local coordinate system.
Returns
  • 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 The spatial reference.

public static SpatialReference fromJson (JsonParser parser)

Returns spatial reference from JsonParser.

Parameters
parser The JSON parser.
Returns
  • 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 Point[] fromMilitaryGrid (String[] mgrsStrings, int mgrsConversionMode)

Converts Military Grid strings into coordinates.

Parameters
mgrsStrings Strings to convert to points.
mgrsConversionMode use the MgrsConversionMode interface for conversion options.
Returns
  • An array of points.

public SpatialReference.Type getCoordinateSystemType ()

Returns map projection type.

Returns
  • Map Projection Type

public SpatialReference getGCS ()

Get the Geographic Coordinate System of the spatial reference.

Returns
  • 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
  • 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.

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.

public Envelope getPannableExtent ()

Returns the pannable extent.

Returns
  • Envelope object.

public String getText ()

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

public double getTolerance ()

Get the XY tolerance of the spatial reference

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

public Unit getUnit ()

Returns the unit from a spatial reference

Returns
  • The spatial reference unit.

public boolean isAnyWebMercator ()

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

Returns
  • boolean

public boolean isWGS84 ()

Returns true/false if the spatial reference is 4326.

Returns
  • boolean

public String[] toMilitaryGrid (int mgrsConversionMode, int numOfDigits, boolean rounding, boolean addSpaces, Point[] coordinates)

Converts a list of coordinates into military grid strings. Each string is 15 characters (2 numbers, 3 letters, 10 numbers OR 3 letters plus 10 numbers [polar region]). Default should be (5 for 2 #s, 3 letters and 10 numbers, and a total of 15).

Parameters
mgrsConversionMode use the MgrsConversionMode interface for conversion options
Returns
  • array of MGRS strings