com.esri.core.geometry
Class SpatialReference

java.lang.Object
  extended by com.esri.core.geometry.SpatialReference
All Implemented Interfaces:
Serializable

public class SpatialReference
extends Object
implements Serializable

An abstract class that represent the spatial reference for the geometry. SpatialReference classes are immutable.

See Also:
Serialized Form

Nested Class Summary
static class SpatialReference.Type
          The spatial reference type can be local, geographic, or projected.
 
Constructor Summary
SpatialReference(String wktext)
           
 
Method Summary
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.
static SpatialReference fromJson(org.codehaus.jackson.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.
 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
 String[] toMilitaryGrid(int mgrsConversionMode, int numOfDigits, boolean rounding, boolean addSpaces, Point[] coordinates)
          Converts a list of coordinates into military grid strings.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpatialReference

public SpatialReference(String wktext)
Method Detail

create

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.

create

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.

createLocal

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.

createLocal

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.

fromJson

public static SpatialReference fromJson(org.codehaus.jackson.JsonParser parser)
                                 throws Exception
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

getCoordinateSystemType

public SpatialReference.Type getCoordinateSystemType()
Returns map projection type.

Returns:
Map Projection Type

getID

public int getID()
Returns the well known ID for the horizontal coordinate system of the spatial reference.

Returns:
wkid The well known ID.

getLatestID

public int getLatestID()
Returns the most current well known ID, the Geometry engine knows about, for the horizontal coordinate system.


getOldID

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.


getText

public String getText()
Returns the well known text for the for the horizontal coordinate system of the spatial reference.


getUnit

public Unit getUnit()
Returns the unit from a spatial reference

Returns:
The spatial reference unit.

toMilitaryGrid

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
numOfDigits -
rounding -
addSpaces -
coordinates -
Returns:
array of MGRS strings

fromMilitaryGrid

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.

getTolerance

public double getTolerance()
Get the XY tolerance of the spatial reference

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

getGCS

public SpatialReference getGCS()
Get the Geographic Coordinate System of the spatial reference.

Returns:
The geographic coordinate system of the spatial reference.


Copyright © 2012. All Rights Reserved.