Package org.geolatte.geom.crs
Class CrsId
- java.lang.Object
-
- org.geolatte.geom.crs.CrsId
-
- Direct Known Subclasses:
CrsExtendedId
public class CrsId extends Object
An identifier for aCoordinateReferenceSystemor other object referenced in aCoordinateReferenceSystemdefinition.A commonly used alternative name for
CrsIdis "SRID".A
CrsIdconsists of the name of an authority and a numeric identifier. The authority is the organization that is responsible for managing the definition of the identified object.In practice,
CoordinateReferenceSystems are usually identified by their EPSG code, with EPSG the authority for the identifier. In this implementation, EPSG is the default authority.- Author:
- Karel Maesen, Geovise BVBA, 2011
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_AUTHORITYstatic CrsIdUNDEFINEDIdentifies an undefined (or unknown)CrsId.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)CrsIdextend(LinearUnit zUnit, Unit mUnit)Creates an instance that identifies the crs identified by thisCrsId, but extended with (optionally) a vertical or measure axis.StringgetAuthority()Returns the authority for thisCrsId.intgetCode()Returns the code for thisCrsId.inthashCode()static CrsIdparse(String srsString)Creates an instance from aStringof the form "[<authority>:]<code>".StringtoString()StringtoUrn()static CrsIdvalueOf(int code)Returns aCrsIdwith the specified code and the EPSG as authority.static CrsIdvalueOf(String authority, int code)Returns an instance having the specified authority and code.
-
-
-
Field Detail
-
DEFAULT_AUTHORITY
public static final String DEFAULT_AUTHORITY
- See Also:
- Constant Field Values
-
UNDEFINED
public static final CrsId UNDEFINED
Identifies an undefined (or unknown)CrsId.
-
-
Constructor Detail
-
CrsId
public CrsId(String authority, int code)
Creates an instance having the specified authority and code.If authority EPSG and 0 or -1 is passed for the code parameter, a value equal to
CrsId.UNDEFINEDis returned.- Parameters:
authority- the authority that assigned the codecode- the code for theCoordinateReferenceSystem
-
-
Method Detail
-
parse
public static CrsId parse(String srsString)
Creates an instance from aStringof the form "[<authority>:]<code>".If the "authority" prefix is missing, then the authority will be assumed to be EPSG.
- Parameters:
srsString- the string to parse into aCrsId.- Returns:
- Throws:
IllegalArgumentException- when the string can nog be parsed as
-
valueOf
public static CrsId valueOf(String authority, int code)
Returns an instance having the specified authority and code.- Parameters:
authority- the authority that assigned the codecode- the code for theCoordinateReferenceSystem- Returns:
- a
CrsIdfor the specified authority and code.
-
valueOf
public static CrsId valueOf(int code)
Returns aCrsIdwith the specified code and the EPSG as authority.- Parameters:
code- the code for theCrsId.- Returns:
- a
CrsIdfor the specified code,and EPSG as authority.
-
getAuthority
public String getAuthority()
Returns the authority for thisCrsId.- Returns:
- a String representing the authority for this
CrsId
-
getCode
public int getCode()
Returns the code for thisCrsId.- Returns:
- the numeric code for this
CrsId
-
toUrn
public String toUrn()
-
extend
public CrsId extend(LinearUnit zUnit, Unit mUnit)
Creates an instance that identifies the crs identified by thisCrsId, but extended with (optionally) a vertical or measure axis.- Parameters:
zUnit- the unit for the vertical axis (or null if there is no such axis)mUnit- the unit for the measure axis (or null if there is no such axis)- Returns:
-
-