Class DefaultDerivedCRS

All Implemented Interfaces:
Serializable, Formattable, Deprecable, LenientComparable, org.opengis.referencing.crs.CoordinateReferenceSystem, org.opengis.referencing.crs.DerivedCRS, org.opengis.referencing.crs.GeneralDerivedCRS, org.opengis.referencing.crs.SingleCRS, org.opengis.referencing.IdentifiedObject, org.opengis.referencing.ReferenceSystem
Direct Known Subclasses:
DefaultDerivedCRS.Engineering, DefaultDerivedCRS.Geodetic, DefaultDerivedCRS.Parametric, DefaultDerivedCRS.Temporal, DefaultDerivedCRS.Vertical

public class DefaultDerivedCRS extends AbstractDerivedCRS<org.opengis.referencing.operation.Conversion> implements org.opengis.referencing.crs.DerivedCRS
A coordinate reference system that is defined by its coordinate conversion from another CRS (not by a datum). DerivedCRS cannot be projected CRS themselves, but may be derived from a projected CRS (for example in order to use a polar coordinate system).

A DerivedCRS instance may also implement one of the interfaces listed below, provided that the conditions in the right column are met (derived from ISO 19162):

Derived CRS types
Type Conditions
GeodeticCRS Base CRS is also a GeodeticCRS and is associated to the same type of coordinate system.
VerticalCRS Base CRS is also a VerticalCRS and coordinate system is a VerticalCS.
TemporalCRS Base CRS is also a TemporalCRS and coordinate system is a TimeCS.
ParametricCRS Base CRS is also a ParametricCRS and coordinate system is a ParametricCS.
EngineeringCRS Base CRS is a GeodeticCRS, ProjectedCRS or EngineeringCRS.
Those specialized subclasses can be inferred automatically by the create(…) static method. Alternatively, users can create their own DefaultDerivedCRS subclass implementing the desired interface.

Immutability and thread safety

This base class is immutable and thus thread-safe if the property values (not necessarily the map itself) given to the constructor are also immutable. Most SIS subclasses and related classes are immutable under similar conditions. This means that unless otherwise noted in the javadoc, GeneralDerivedCRS instances created using only SIS factories and static constants can be shared by many objects and passed between threads without synchronization.
Since:
0.6
Version:
1.3
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static final class 
    An derived engineering CRS.
    private static final class 
    A derived geodetic CRS.
    private static final class 
    A derived parametric CRS.
    private static final class 
    A derived temporal CRS.
    private static final class 
    A derived vertical CRS.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final long
    Serial number for inter-operability with different versions.

    Fields inherited from class org.apache.sis.referencing.AbstractIdentifiedObject

    DEPRECATED_KEY, LOCALE_KEY

    Fields inherited from interface org.opengis.referencing.IdentifiedObject

    ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY

    Fields inherited from interface org.opengis.referencing.ReferenceSystem

    DOMAIN_OF_VALIDITY_KEY, SCOPE_KEY
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Constructs a new object in which every attributes are set to a default value.
    protected
    DefaultDerivedCRS(Map<String,?> properties, org.opengis.referencing.crs.SingleCRS baseCRS, org.opengis.referencing.crs.CoordinateReferenceSystem interpolationCRS, org.opengis.referencing.operation.OperationMethod method, org.opengis.referencing.operation.MathTransform baseToDerived, org.opengis.referencing.cs.CoordinateSystem derivedCS)
    Creates a derived CRS from a math transform.
    protected
    DefaultDerivedCRS(Map<String,?> properties, org.opengis.referencing.crs.SingleCRS baseCRS, org.opengis.referencing.operation.Conversion conversion, org.opengis.referencing.cs.CoordinateSystem derivedCS)
    Creates a derived CRS from a defining conversion.
    protected
    DefaultDerivedCRS(org.opengis.referencing.crs.DerivedCRS crs)
    Constructs a new coordinate reference system with the same values than the specified one.
  • Method Summary

    Modifier and Type
    Method
    Description
    castOrCopy(org.opengis.referencing.crs.DerivedCRS object)
    Returns a SIS coordinate reference system implementation with the same values than the given arbitrary implementation.
    protected long
    Invoked by hashCode() for computing the hash code when first needed.
    create(Map<String,?> properties, org.opengis.referencing.crs.SingleCRS baseCRS, org.opengis.referencing.crs.CoordinateReferenceSystem interpolationCRS, org.opengis.referencing.operation.OperationMethod method, org.opengis.referencing.operation.MathTransform baseToDerived, org.opengis.referencing.cs.CoordinateSystem derivedCS)
    Creates a derived CRS from a math transform and a type inferred from the given arguments.
    create(Map<String,?> properties, org.opengis.referencing.crs.SingleCRS baseCRS, org.opengis.referencing.operation.Conversion conversion, org.opengis.referencing.cs.CoordinateSystem derivedCS)
    Creates a derived CRS from a defining conversion and a type inferred from the given arguments.
    (package private) AbstractCRS
    createSameType(Map<String,?> properties, org.opengis.referencing.cs.CoordinateSystem derivedCS)
    Returns a coordinate reference system of the same type than this CRS but with different axes.
    boolean
    equals(Object object, ComparisonMode mode)
    Compares this coordinate reference system with the specified object for equality.
    Returns a coordinate reference system equivalent to this one but with axes rearranged according the given convention.
    protected String
    formatTo(Formatter formatter)
    Formats the inner part of the Well Known Text (WKT) representation of this CRS.
    org.opengis.referencing.crs.SingleCRS
    Returns the CRS on which the conversion is applied.
    org.opengis.referencing.operation.Conversion
    Returns the conversion from the base CRS to this CRS.
    (package private) final Class<org.opengis.referencing.operation.Conversion>
    Returns the type of conversion associated to this DefaultDerivedCRS.
    org.opengis.referencing.cs.CoordinateSystem
    Returns the coordinate system.
    org.opengis.referencing.datum.Datum
    Returns the datum of the base CRS.
    Class<? extends org.opengis.referencing.crs.DerivedCRS>
    Returns the GeoAPI interface implemented by this class.
    (package private) SC_DerivedCRSType
    Returns the <gml:derivedCRSType> element to marshal.
    (package private) static String
    getType(org.opengis.referencing.crs.SingleCRS baseCRS, org.opengis.referencing.cs.CoordinateSystem derivedCS)
    Returns the WKT 2 keyword for a DerivedCRS having the given base CRS and derived coordinate system.
    (package private) String
    keyword(Formatter formatter)
    Return the WKT 2 keyword for this DerivedCRS, or null if unknown.
    private void
    setBaseCRS(org.opengis.referencing.crs.SingleCRS crs)
    Used by JAXB only (invoked by reflection).
    private void
    setCoordinateSystem(org.opengis.referencing.cs.CoordinateSystem cs)
    Used by JAXB only (invoked by reflection).

    Methods inherited from class org.apache.sis.referencing.crs.AbstractDerivedCRS

    setBaseCRS

    Methods inherited from class org.apache.sis.referencing.crs.AbstractCRS

    castOrCopy, formatCS, getCached, getCoordinateSystem, isBaseCRS, setCached, setCoordinateSystem

    Methods inherited from class org.apache.sis.referencing.AbstractReferenceSystem

    getDomainOfValidity, getScope

    Methods inherited from class org.apache.sis.io.wkt.FormattableObject

    print, toString, toString, toWKT

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.opengis.referencing.IdentifiedObject

    getAlias, getIdentifiers, getName, getRemarks, toWKT

    Methods inherited from interface org.opengis.referencing.ReferenceSystem

    getDomainOfValidity, getScope
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Serial number for inter-operability with different versions.
      See Also:
  • Constructor Details

    • DefaultDerivedCRS

      protected DefaultDerivedCRS(Map<String,?> properties, org.opengis.referencing.crs.SingleCRS baseCRS, org.opengis.referencing.operation.Conversion conversion, org.opengis.referencing.cs.CoordinateSystem derivedCS) throws org.opengis.geometry.MismatchedDimensionException
      Creates a derived CRS from a defining conversion. The properties given in argument follow the same rules than for the super-class constructor. The following table is a reminder of main (not all) properties:
      Recognized properties (non exhaustive list)
      Property name Value type Returned by
      "name" Identifier or String AbstractIdentifiedObject.getName()
      "alias" GenericName or CharSequence (optionally as array) AbstractIdentifiedObject.getAlias()
      "identifiers" Identifier (optionally as array) AbstractIdentifiedObject.getIdentifiers()
      "remarks" InternationalString or String AbstractIdentifiedObject.getRemarks()
      "domainOfValidity" Extent AbstractReferenceSystem.getDomainOfValidity()
      "scope" InternationalString or String AbstractReferenceSystem.getScope()
      The supplied conversion argument shall not includes the operation steps for performing unit conversions and change of axis order since those operations will be inferred by this constructor.
      Parameters:
      properties - the properties to be given to the new derived CRS object.
      baseCRS - coordinate reference system to base the derived CRS on.
      conversion - the defining conversion from a normalized base to a normalized derived CRS.
      derivedCS - the coordinate system for the derived CRS. The number of axes must match the target dimension of the baseToDerived transform.
      Throws:
      org.opengis.geometry.MismatchedDimensionException - if the source and target dimensions of baseToDerived do not match the dimensions of base and derivedCS respectively.
      See Also:
    • DefaultDerivedCRS

      protected DefaultDerivedCRS(Map<String,?> properties, org.opengis.referencing.crs.SingleCRS baseCRS, org.opengis.referencing.crs.CoordinateReferenceSystem interpolationCRS, org.opengis.referencing.operation.OperationMethod method, org.opengis.referencing.operation.MathTransform baseToDerived, org.opengis.referencing.cs.CoordinateSystem derivedCS)
      Creates a derived CRS from a math transform. The given MathTransform shall transform coordinate values specifically from the baseCRS to this CRS (optionally with an interpolation CRS); there is no consideration about “normalized CRS” in this constructor.

      Conversion properties

      The properties map given in argument can contain any entries documented in the above constructor, together with any entries documented by the conversion constructor provided that the Conversion entry keys are prefixed by "conversion.". In particular, the two first properties listed below are mandatory:
      Mandatory properties and some optional properties
      Property name Value type Returned by
      "name" Identifier or String this.getName()
      "conversion.name" Identifier or String conversionFromBase.getName()
      Optional properties (non exhaustive list)
      "identifiers" Identifier (optionally as array) this.getIdentifiers()
      "domainOfValidity" Extent conversionFromBase.getDomainOfValidity()
      Parameters:
      properties - the properties to be given to the DefaultConversion object (with keys prefixed by "conversion.") and to the new derived CRS object.
      baseCRS - coordinate reference system to base the derived CRS on.
      interpolationCRS - the CRS of additional coordinates needed for the operation, or null if none.
      method - the coordinate operation method (mandatory in all cases).
      baseToDerived - transform from positions in the base CRS to positions in this target CRS.
      derivedCS - the coordinate system for the derived CRS.
      Throws:
      IllegalArgumentException - if at least one argument has an incompatible number of dimensions.
      See Also:
    • DefaultDerivedCRS

      protected DefaultDerivedCRS(org.opengis.referencing.crs.DerivedCRS crs)
      Constructs a new coordinate reference system with the same values than the specified one. This copy constructor provides a way to convert an arbitrary implementation into a SIS one or a user-defined one (as a subclass), usually in order to leverage some implementation-specific API.

      This constructor performs a shallow copy, i.e. the properties are not cloned.

      Parameters:
      crs - the coordinate reference system to copy.
      See Also:
    • DefaultDerivedCRS

      private DefaultDerivedCRS()
      Constructs a new object in which every attributes are set to a default value. This is not a valid object. This constructor is strictly reserved to JAXB, which will assign values to the fields using reflection.
  • Method Details

    • create

      public static DefaultDerivedCRS create(Map<String,?> properties, org.opengis.referencing.crs.SingleCRS baseCRS, org.opengis.referencing.operation.Conversion conversion, org.opengis.referencing.cs.CoordinateSystem derivedCS) throws org.opengis.geometry.MismatchedDimensionException
      Creates a derived CRS from a defining conversion and a type inferred from the given arguments. This method expects the same arguments and performs the same work than the above constructor, except that the DerivedCRS instance returned by this method may additionally implement the GeodeticCRS, VerticalCRS, TemporalCRS, ParametricCRS or EngineeringCRS interface. See the class javadoc for more information.
      Parameters:
      properties - the properties to be given to the new derived CRS object.
      baseCRS - coordinate reference system to base the derived CRS on.
      conversion - the defining conversion from a normalized base to a normalized derived CRS.
      derivedCS - the coordinate system for the derived CRS. The number of axes must match the target dimension of the baseToDerived transform.
      Returns:
      the newly created derived CRS, potentially implementing an additional CRS interface.
      Throws:
      org.opengis.geometry.MismatchedDimensionException - if the source and target dimensions of baseToDerived do not match the dimensions of base and derivedCS respectively.
      See Also:
    • create

      public static DefaultDerivedCRS create(Map<String,?> properties, org.opengis.referencing.crs.SingleCRS baseCRS, org.opengis.referencing.crs.CoordinateReferenceSystem interpolationCRS, org.opengis.referencing.operation.OperationMethod method, org.opengis.referencing.operation.MathTransform baseToDerived, org.opengis.referencing.cs.CoordinateSystem derivedCS)
      Creates a derived CRS from a math transform and a type inferred from the given arguments. This method expects the same arguments and performs the same work than the above constructor, except that the DerivedCRS instance returned by this method may additionally implement the GeodeticCRS, VerticalCRS, TemporalCRS, ParametricCRS or EngineeringCRS interface. See the class javadoc for more information.
      Parameters:
      properties - the properties to be given to the DefaultConversion object (with keys prefixed by "conversion.") and to the new derived CRS object.
      baseCRS - coordinate reference system to base the derived CRS on.
      interpolationCRS - the CRS of additional coordinates needed for the operation, or null if none.
      method - the coordinate operation method (mandatory in all cases).
      baseToDerived - transform from positions in the base CRS to positions in this target CRS.
      derivedCS - the coordinate system for the derived CRS.
      Returns:
      the newly created derived CRS, potentially implementing an additional CRS interface.
      Throws:
      IllegalArgumentException - if at least one argument has an incompatible number of dimensions.
      See Also:
    • castOrCopy

      public static DefaultDerivedCRS castOrCopy(org.opengis.referencing.crs.DerivedCRS object)
      Returns a SIS coordinate reference system implementation with the same values than the given arbitrary implementation. If the given object is null, then this method returns null. Otherwise if the given object is already a SIS implementation, then the given object is returned unchanged. Otherwise a new SIS implementation is created and initialized to the attribute values of the given object.
      Parameters:
      object - the object to get as a SIS implementation, or null if none.
      Returns:
      a SIS implementation containing the values of the given object (may be the given object itself), or null if the argument was null.
    • getConversionType

      final Class<org.opengis.referencing.operation.Conversion> getConversionType()
      Returns the type of conversion associated to this DefaultDerivedCRS. Must be a hard-coded, constant value (not dependent on object state).
      Specified by:
      getConversionType in class AbstractDerivedCRS<org.opengis.referencing.operation.Conversion>
    • getInterface

      public Class<? extends org.opengis.referencing.crs.DerivedCRS> getInterface()
      Returns the GeoAPI interface implemented by this class. The SIS implementation returns DerivedCRS.class.
      Note for implementers: Subclasses usually do not need to override this method since GeoAPI does not define DerivedCRS sub-interface. Overriding possibility is left mostly for implementers who wish to extend GeoAPI with their own set of interfaces.
      Specified by:
      getInterface in class AbstractDerivedCRS<org.opengis.referencing.operation.Conversion>
      Returns:
      DerivedCRS.class or a user-defined sub-interface.
    • getDatum

      public org.opengis.referencing.datum.Datum getDatum()
      Returns the datum of the base CRS.
      Specified by:
      getDatum in interface org.opengis.referencing.crs.SingleCRS
      Specified by:
      getDatum in class AbstractDerivedCRS<org.opengis.referencing.operation.Conversion>
      Returns:
      the datum of the base CRS.
    • getBaseCRS

      public org.opengis.referencing.crs.SingleCRS getBaseCRS()
      Returns the CRS on which the conversion is applied. This CRS defines the datum of this CRS and (at least implicitly) the source of the conversion from base.
      Specified by:
      getBaseCRS in interface org.opengis.referencing.crs.GeneralDerivedCRS
      Returns:
      the base coordinate reference system.
    • getConversionFromBase

      public org.opengis.referencing.operation.Conversion getConversionFromBase()
      Returns the conversion from the base CRS to this CRS. In Apache SIS, the conversion source and target CRS are set to the following values:
      Note: This is different than ISO 19111, which allows source and target CRS to be null.
      Specified by:
      getConversionFromBase in interface org.opengis.referencing.crs.GeneralDerivedCRS
      Overrides:
      getConversionFromBase in class AbstractDerivedCRS<org.opengis.referencing.operation.Conversion>
      Returns:
      the conversion to this CRS.
    • getCoordinateSystem

      public org.opengis.referencing.cs.CoordinateSystem getCoordinateSystem()
      Returns the coordinate system.
      Specified by:
      getCoordinateSystem in interface org.opengis.referencing.crs.CoordinateReferenceSystem
      Specified by:
      getCoordinateSystem in interface org.opengis.referencing.crs.SingleCRS
      Overrides:
      getCoordinateSystem in class AbstractCRS
      Returns:
      the coordinate system.
    • forConvention

      public DefaultDerivedCRS forConvention(AxesConvention convention)
      Returns a coordinate reference system equivalent to this one but with axes rearranged according the given convention. If this CRS is already compatible with the given convention, then this method returns this.
      Overrides:
      forConvention in class AbstractCRS
      Parameters:
      convention - the axes convention for which a coordinate reference system is desired.
      Returns:
      a coordinate reference system compatible with the given convention (may be this).
      See Also:
    • createSameType

      AbstractCRS createSameType(Map<String,?> properties, org.opengis.referencing.cs.CoordinateSystem derivedCS)
      Returns a coordinate reference system of the same type than this CRS but with different axes.
      Overrides:
      createSameType in class AbstractCRS
    • equals

      public boolean equals(Object object, ComparisonMode mode)
      Compares this coordinate reference system with the specified object for equality. In addition to the metadata documented in the parent class, this method considers coordinate system axes of the base CRS as metadata. This means that if the given ComparisonMode is IGNORE_METADATA or APPROXIMATE, then axis order of the base CRS are ignored (but not axis order of this derived CRS).
      Specified by:
      equals in interface LenientComparable
      Overrides:
      equals in class AbstractDerivedCRS<org.opengis.referencing.operation.Conversion>
      Parameters:
      object - the object to compare to this.
      mode - STRICT for performing a strict comparison, or IGNORE_METADATA for comparing only properties relevant to coordinate transformations.
      Returns:
      true if both objects are equal.
      See Also:
    • computeHashCode

      protected long computeHashCode()
      Invoked by hashCode() for computing the hash code when first needed. See AbstractIdentifiedObject.computeHashCode() for more information.
      Overrides:
      computeHashCode in class AbstractDerivedCRS<org.opengis.referencing.operation.Conversion>
      Returns:
      the hash code value. This value may change in any future Apache SIS version.
    • formatTo

      protected String formatTo(Formatter formatter)
      Formats the inner part of the Well Known Text (WKT) representation of this CRS.
      Overrides:
      formatTo in class AbstractCRS
      Parameters:
      formatter - the formatter where to format the inner content of this WKT element.
      Returns:
      "Fitted_CS" (WKT 1) or a type-dependent keyword (WKT 2).
      See Also:
    • keyword

      String keyword(Formatter formatter)
      Return the WKT 2 keyword for this DerivedCRS, or null if unknown. Inner subclasses will override this method for returning a constant value instead than trying to infer it from the components.
    • getType

      static String getType(org.opengis.referencing.crs.SingleCRS baseCRS, org.opengis.referencing.cs.CoordinateSystem derivedCS)
      Returns the WKT 2 keyword for a DerivedCRS having the given base CRS and derived coordinate system. If the type cannot be identifier, then this method returns null.
    • getType

      Returns the <gml:derivedCRSType> element to marshal. The default implementation tries to infer this information from the DefaultDerivedCRS properties, but subclasses will override for more determinism.
      Note: there is no setter at this time because SIS does not store this information in a DefaultDerivedCRS field. Instead, we rely on the interface that we implement. For example, a DefaultDerivedCRS of type SC_DerivedCRSType.vertical will implement the VerticalCRS interface.
    • setBaseCRS

      private void setBaseCRS(org.opengis.referencing.crs.SingleCRS crs)
      Used by JAXB only (invoked by reflection).
      See Also:
    • setCoordinateSystem

      private void setCoordinateSystem(org.opengis.referencing.cs.CoordinateSystem cs)
      Used by JAXB only (invoked by reflection).
      See Also: