# Class DefaultProjectedCRS

Object
FormattableObject
AbstractIdentifiedObject
AbstractReferenceSystem
AbstractCRS
DefaultProjectedCRS

All Implemented Interfaces:
  `Serializable, Formattable, Deprecable, LenientComparable, Printable, CoordinateReferenceSystem, GeneralDerivedCRS, ProjectedCRS, SingleCRS, IdentifiedObject, ReferenceSystem`

public class DefaultProjectedCRS extends AbstractCRS implements ProjectedCRS
A 2-dimensional coordinate reference system used to approximate the shape of the earth on a planar surface. It is done in such a way that the distortion that is inherent to the approximation is carefully controlled and known. Distortion correction is commonly applied to calculated bearings and distances to produce values that are a close match to actual field values.

Used with datum type: Geodetic.
Used with coordinate system type: Cartesian.

## Immutability and thread safety

This class is immutable and thus thread-safe if the property values (not necessarily the map itself), the coordinate system and the datum instances given to the constructor are also immutable. Unless otherwise noted in the javadoc, this condition holds if all components were created using only SIS factories and static constants.

Since:
  0.6
See Also:
  - `GeodeticAuthorityFactory​.createProjectedCRS(String)`
  - Serialized Form

- ## Field Summary

  ### Fields inherited from class AbstractIdentifiedObject

  `DEPRECATED_KEY, DOMAINS_KEY, LOCALE_KEY`

  ### Fields inherited from interface IdentifiedObject

  `ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY`

  ### Fields inherited from interface ReferenceSystem

  `DOMAIN_OF_VALIDITY_KEY, SCOPE_KEY`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  ``
  `DefaultProjectedCRS(Map<String,?> properties, GeographicCRS baseCRS, Conversion baseToDerived, CartesianCS derivedCS)`
  Creates a projected CRS from a defining conversion.
  `protected`
  `DefaultProjectedCRS(ProjectedCRS crs)`
  Constructs a new coordinate reference system with the same values as the specified one.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static DefaultProjectedCRS`
  `castOrCopy(ProjectedCRS object)`
  Returns a SIS coordinate reference system implementation with the same values as the given arbitrary implementation.
  `boolean`
  `equals(Object object, ComparisonMode mode)`
  Compares this coordinate reference system with the specified object for equality.
  `DefaultProjectedCRS`
  `forConvention(AxesConvention convention)`
  Returns a CRS 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.
  `GeographicCRS`
  `getBaseCRS()`
  Returns the geographic CRS on which the map projection is applied.
  `Projection`
  `getConversionFromBase()`
  Returns the map projection from the base CRS to this CRS.
  `final CartesianCS`
  `getCoordinateSystem()`
  Returns the coordinate system.
  `GeodeticDatum`
  `getDatum()`
  Returns the datum of the base CRS.
  `DefaultDatumEnsemble<GeodeticDatum>`
  `getDatumEnsemble()`
  Returns the datum ensemble of the base CRS.
  `Class<? extends ProjectedCRS>`
  `getInterface()`
  Returns the GeoAPI interface implemented by this class.

  ### Methods inherited from class AbstractCRS

  `castOrCopy`

  ### Methods inherited from class AbstractReferenceSystem

  `getDomainOfValidity, getScope`

  ### Methods inherited from class AbstractIdentifiedObject

  `castOrCopy, equals, formatTo, getAlias, getDescription, getDomains, getIdentifiers, getName, getRemarks, hashCode, isDeprecated, isHeuristicMatchForName`

  ### Methods inherited from class FormattableObject

  `print, toString, toString, toWKT`

  ### Methods inherited from class Object

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

  ### Methods inherited from interface IdentifiedObject

  `getAlias, getIdentifiers, getName, getRemarks, toWKT`

  ### Methods inherited from interface ReferenceSystem

  `getDomainOfValidity, getScope`

- ## Constructor Details

  - ### DefaultProjectedCRS

    public DefaultProjectedCRS(Map<String,?> properties, GeographicCRS baseCRS, Conversion baseToDerived, CartesianCS derivedCS) throws MismatchedDimensionException
    Creates a projected CRS from a defining conversion. The properties given in argument follow the same rules as 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()`
    "domains" | `DefaultObjectDomain` (optionally as array) | `AbstractIdentifiedObject.getDomains()`
    "remarks" | `InternationalString` or `String` | `AbstractIdentifiedObject.getRemarks()`

    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.
      `baseToDerived` - 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:
      `MismatchedDimensionException` - if the source and target dimensions of `baseToDerived` do not match the dimensions of `base` and `derivedCS` respectively.
    See Also:
      - `GeodeticObjectFactory​.createProjectedCRS(Map, GeographicCRS, Conversion, CartesianCS)`

  - ### DefaultProjectedCRS

    protected DefaultProjectedCRS(ProjectedCRS crs)
    Constructs a new coordinate reference system with the same values as 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:
      - `castOrCopy(ProjectedCRS)`

- ## Method Details

  - ### castOrCopy

    public static DefaultProjectedCRS castOrCopy(ProjectedCRS object)
    Returns a SIS coordinate reference system implementation with the same values as 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.

  - ### getInterface

    public Class<? extends ProjectedCRS> getInterface()
    Returns the GeoAPI interface implemented by this class. The SIS implementation returns `ProjectedCRS​.class`.

    #### Note for implementers

    Subclasses usually do not need to override this method since GeoAPI does not define `ProjectedCRS` sub-interface. Overriding possibility is left mostly for implementers who wish to extend GeoAPI with their own set of interfaces.
    Overrides:
      `getInterface` in class `AbstractCRS`
    Returns:
      `ProjectedCRS​.class` or a user-defined sub-interface.

  - ### getDatum

    public GeodeticDatum getDatum()
    Returns the datum of the base CRS. This property may be null if this CRS is related to an object identified only by a datum ensemble.
    Specified by:
      `getDatum` in interface `ProjectedCRS`
    Specified by:
      `getDatum` in interface `SingleCRS`
    Returns:
      the datum of the base CRS, or `null` if this CRS is related to an object identified only by a datum ensemble.

  - ### getDatumEnsemble

    public DefaultDatumEnsemble<GeodeticDatum> getDatumEnsemble()
    Returns the datum ensemble of the base CRS. This property may be null if this CRS is related to an object identified only by a reference frame.
    Returns:
      the datum ensemble of the base CRS, or `null` if this CRS is related to an object identified only by a datum.
    Since:
      1.5

  - ### getBaseCRS

    public GeographicCRS getBaseCRS()
    Returns the geographic CRS on which the map projection 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 `GeneralDerivedCRS`
    Specified by:
      `getBaseCRS` in interface `ProjectedCRS`
    Returns:
      the base coordinate reference system, which must be geographic.

  - ### getConversionFromBase

    public Projection getConversionFromBase()
    Returns the map projection from the base CRS to this CRS. In Apache SIS, the conversion source and target CRS are set to the following values:
    - The conversion source CRS is the base CRS of `this` CRS.
    - The conversion target CRS is `this` CRS.
    Note: This is different than ISO 19111, which allows source and target CRS to be `null`.
    Specified by:
      `getConversionFromBase` in interface `GeneralDerivedCRS`
    Specified by:
      `getConversionFromBase` in interface `ProjectedCRS`
    Returns:
      the map projection from base CRS to this CRS.

  - ### getCoordinateSystem

    public final CartesianCS getCoordinateSystem()
    Returns the coordinate system.
    Specified by:
      `getCoordinateSystem` in interface `CoordinateReferenceSystem`
    Specified by:
      `getCoordinateSystem` in interface `ProjectedCRS`
    Specified by:
      `getCoordinateSystem` in interface `SingleCRS`
    Overrides:
      `getCoordinateSystem` in class `AbstractCRS`
    Returns:
      the coordinate system.

  - ### forConvention

    public DefaultProjectedCRS forConvention(AxesConvention convention)
    Returns a CRS 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:
      - `AbstractCS​.forConvention(AxesConvention)`

  - ### 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 more permissive, then axis order of the base geodetic CRS is ignored (but not axis order of this projected CRS).
    Specified by:
      `equals` in interface `LenientComparable`
    Overrides:
      `equals` in class `AbstractCRS`
    Parameters:
      `object` - the object to compare to `this`.
      `mode` - the strictness level of the comparison.
    Returns:
      `true` if both objects are equal.
    See Also:
      - `AbstractIdentifiedObject​.computeHashCode()`
      - `Utilities​.deepEquals(Object, Object, ComparisonMode)`

  - ### formatTo

    protected String formatTo(Formatter formatter)
    Formats the inner part of the Well Known Text (WKT) representation of this CRS.

    #### Example

    Well-Known Text (version 2) of a projected coordinate reference system using the Lambert Conformal method.

        ProjectedCRS[“NTF (Paris) / Lambert zone II”,
          BaseGeogCRS[“NTF (Paris)”,
            Datum[“Nouvelle Triangulation Francaise”,
              Ellipsoid[“NTF”, 6378249.2, 293.4660212936269, LengthUnit[“metre”, 1]]],
              PrimeMeridian[“Paris”, 2.5969213, AngleUnit[“grad”, 0.015707963267948967]]],
          Conversion[“Lambert zone II”,
            Method[“Lambert Conic Conformal (1SP)”, Id[“EPSG”, 9801, Citation[“IOGP”]]],
            Parameter[“Latitude of natural origin”, 52.0, AngleUnit[“grad”, 0.015707963267948967], Id[“EPSG”, 8801]],
            Parameter[“Longitude of natural origin”, 0.0, AngleUnit[“degree”, 0.017453292519943295], Id[“EPSG”, 8802]],
            Parameter[“Scale factor at natural origin”, 0.99987742, ScaleUnit[“unity”, 1], Id[“EPSG”, 8805]],
            Parameter[“False easting”, 600000.0, LengthUnit[“metre”, 1], Id[“EPSG”, 8806]],
            Parameter[“False northing”, 2200000.0, LengthUnit[“metre”, 1], Id[“EPSG”, 8807]]],
          CS[“Cartesian”, 2],
            Axis[“Easting (E)”, east, Order[1]],
            Axis[“Northing (N)”, north, Order[2]],
            LengthUnit[“metre”, 1],
          Id[“EPSG”, 27572, Citation[“IOGP”], URI[“urn:ogc:def:crs:EPSG::27572”]]]

    Same coordinate reference system using WKT 1.

        PROJCS[“NTF (Paris) / Lambert zone II”,
          GEOGCS[“NTF (Paris)”,
            DATUM[“Nouvelle Triangulation Francaise”,
              SPHEROID[“NTF”, 6378249.2, 293.4660212936269]],
              PRIMEM[“Paris”, 2.33722917],
            UNIT[“degree”, 0.017453292519943295],
            AXIS[“Longitude”, EAST],
            AXIS[“Latitude”, NORTH]],
          PROJECTION[“Lambert_Conformal_Conic_1SP”, AUTHORITY[“EPSG”, “9801”]],
          PARAMETER[“latitude_of_origin”, 46.8],
          PARAMETER[“central_meridian”, 0.0],
          PARAMETER[“scale_factor”, 0.99987742],
          PARAMETER[“false_easting”, 600000.0],
          PARAMETER[“false_northing”, 2200000.0],
          UNIT[“metre”, 1],
          AXIS[“Easting”, EAST],
          AXIS[“Northing”, NORTH],
          AUTHORITY[“EPSG”, “27572”]]

    Overrides:
      `formatTo` in class `AbstractCRS`
    Parameters:
      `formatter` - the formatter where to format the inner content of this WKT element.
    Returns:
      `"ProjectedCRS"` (WKT 2) or `"ProjCS"` (WKT 1).
    See Also:
      - `FormattableObject​.toWKT()`
      - `FormattableObject​.toString()`