Class CrsId

  • Direct Known Subclasses:
    CrsExtendedId

    public class CrsId
    extends Object
    An identifier for a CoordinateReferenceSystem or other object referenced in a CoordinateReferenceSystem definition.

    A commonly used alternative name for CrsId is "SRID".

    A CrsId consists 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 Detail

      • 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.UNDEFINED is returned.

        Parameters:
        authority - the authority that assigned the code
        code - the code for the CoordinateReferenceSystem
    • Method Detail

      • parse

        public static CrsId parse​(String srsString)
        Creates an instance from a String of 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 a CrsId.
        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 code
        code - the code for the CoordinateReferenceSystem
        Returns:
        a CrsId for the specified authority and code.
      • valueOf

        public static CrsId valueOf​(int code)
        Returns a CrsId with the specified code and the EPSG as authority.
        Parameters:
        code - the code for the CrsId.
        Returns:
        a CrsId for the specified code,and EPSG as authority.
      • getAuthority

        public String getAuthority()
        Returns the authority for this CrsId.
        Returns:
        a String representing the authority for this CrsId
      • getCode

        public int getCode()
        Returns the code for this CrsId.
        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 this CrsId, 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:
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object