Package org.geotools.referencing.crs
Class DefaultProjectedCRS
-
- All Implemented Interfaces:
Serializable
,CoordinateReferenceSystem
,GeneralDerivedCRS
,ProjectedCRS
,SingleCRS
,IdentifiedObject
,ReferenceSystem
,PROJFormattable
public class DefaultProjectedCRS extends AbstractDerivedCRS implements ProjectedCRS, PROJFormattable
A 2D 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 CS type(s) Cartesian
- Since:
- 2.1
- Author:
- Martin Desruisseaux (IRD)
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class AbstractDerivedCRS
_COMPARING, baseCRS, CONVERSION_TYPE_KEY, conversionFromBase
-
Fields inherited from class AbstractSingleCRS
datum
-
Fields inherited from class AbstractCRS
coordinateSystem
-
Fields inherited from class AbstractIdentifiedObject
EMPTY_ALIAS_ARRAY, EMPTY_IDENTIFIER_ARRAY, IDENTIFIER_COMPARATOR, NAME_COMPARATOR, REMARKS_COMPARATOR
-
Fields inherited from class Formattable
SINGLE_LINE
-
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 Constructor Description DefaultProjectedCRS(String name, GeographicCRS base, MathTransform baseToDerived, CartesianCS derivedCS)
Constructs a projected CRS from a name.DefaultProjectedCRS(Map<String,?> properties, Conversion conversionFromBase, GeographicCRS base, MathTransform baseToDerived, CartesianCS derivedCS)
Constructs a projected CRS from a defining conversion.DefaultProjectedCRS(Map<String,Object> properties, GeographicCRS base, MathTransform baseToDerived, CartesianCS derivedCS)
Constructs a projected CRS from a set of properties.DefaultProjectedCRS(Map<String,Object> properties, OperationMethod method, GeographicCRS base, MathTransform baseToDerived, CartesianCS derivedCS)
Constructs a projected CRS from a set of properties.DefaultProjectedCRS(ProjectedCRS crs)
Constructs a new projected CRS with the same values than the specified one.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
calculateHashCode()
Returns a hash value for this projected CRS.String
formatPROJ(PROJFormatter formatter)
Format the inner part of a PROJFormattable object.protected String
formatWKT(Formatter formatter)
Format the inner part of a Well Known Text (WKT) element.GeographicCRS
getBaseCRS()
Returns the base coordinate reference system, which must be geographic.Projection
getConversionFromBase()
Returns the map projection from the base CRS to this CRS.CartesianCS
getCoordinateSystem()
Returns the coordinate system.GeodeticDatum
getDatum()
Returns the datum.-
Methods inherited from class AbstractDerivedCRS
equals
-
Methods inherited from class AbstractSingleCRS
getAxis, getDimension
-
Methods inherited from class AbstractCRS
distance, hashCode
-
Methods inherited from class AbstractReferenceSystem
getDomainOfValidity, getScope
-
Methods inherited from class AbstractIdentifiedObject
asSet, ensureAngularUnit, ensureLinearUnit, ensureNonNull, ensureNonNull, ensureTimeUnit, equals, equals, equals, equals, getAlias, getIdentifier, getIdentifier, getIdentifiers, getName, getName, getName, getProperties, getProperties, getRemarks, nameMatches, nameMatches, nameMatches
-
Methods inherited from class Formattable
cleanupThreadLocals, toString, toWKT, toWKT, toWKT, toWKT
-
Methods inherited from interface IdentifiedObject
getAlias, getIdentifiers, getName, getRemarks, toWKT
-
Methods inherited from interface ReferenceSystem
getDomainOfValidity, getScope
-
-
-
-
Constructor Detail
-
DefaultProjectedCRS
public DefaultProjectedCRS(ProjectedCRS crs)
Constructs a new projected CRS with the same values than the specified one. This copy constructor provides a way to wrap an arbitrary implementation into a Geotools 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.- Since:
- 2.2
-
DefaultProjectedCRS
public DefaultProjectedCRS(String name, GeographicCRS base, MathTransform baseToDerived, CartesianCS derivedCS) throws MismatchedDimensionException
Constructs a projected CRS from a name. A default operation method is inferred from the math transform. This is a convenience constructor that is not garanteed to work reliably for non-GeoTools implementations. Use the constructor expecting a defining conversion for more determinist result.- Parameters:
name
- The name.base
- Coordinate reference system to base the derived CRS on.baseToDerived
- The transform from the base CRS to returned CRS.derivedCS
- The coordinate system for the derived CRS. The number of axes must match the target dimension of the transformbaseToDerived
.- Throws:
MismatchedDimensionException
- if the source and target dimension ofbaseToDeviced
don't match the dimension ofbase
andderivedCS
respectively.- Since:
- 2.5
-
DefaultProjectedCRS
public DefaultProjectedCRS(Map<String,Object> properties, GeographicCRS base, MathTransform baseToDerived, CartesianCS derivedCS) throws MismatchedDimensionException
Constructs a projected CRS from a set of properties. A default operation method is inferred from the math transform. This is a convenience constructor that is not garanteed to work reliably for non-GeoTools implementations. Use the constructor expecting a defining conversion for more determinist result.The properties are given unchanged to the super-class constructor.
- Parameters:
properties
- Name and other properties to give to the new derived CRS object and to the underlying projection.base
- Coordinate reference system to base the derived CRS on.baseToDerived
- The transform from the base CRS to returned CRS.derivedCS
- The coordinate system for the derived CRS. The number of axes must match the target dimension of the transformbaseToDerived
.- Throws:
MismatchedDimensionException
- if the source and target dimension ofbaseToDeviced
don't match the dimension ofbase
andderivedCS
respectively.- Since:
- 2.5
-
DefaultProjectedCRS
public DefaultProjectedCRS(Map<String,Object> properties, OperationMethod method, GeographicCRS base, MathTransform baseToDerived, CartesianCS derivedCS) throws MismatchedDimensionException
Constructs a projected CRS from a set of properties. The properties are given unchanged to the super-class constructor.- Parameters:
properties
- Name and other properties to give to the new derived CRS object and to the underlying projection.method
- A description of the method for the conversion.base
- Coordinate reference system to base the derived CRS on.baseToDerived
- The transform from the base CRS to returned CRS.derivedCS
- The coordinate system for the derived CRS. The number of axes must match the target dimension of the transformbaseToDerived
.- Throws:
MismatchedDimensionException
- if the source and target dimension ofbaseToDeviced
don't match the dimension ofbase
andderivedCS
respectively.
-
DefaultProjectedCRS
public DefaultProjectedCRS(Map<String,?> properties, Conversion conversionFromBase, GeographicCRS base, MathTransform baseToDerived, CartesianCS derivedCS) throws MismatchedDimensionException
Constructs a projected CRS from a defining conversion. The properties are given unchanged to the super-class constructor.- Parameters:
properties
- Name and other properties to give to the new projected CRS object.conversionFromBase
- The defining conversion.base
- Coordinate reference system to base the projected CRS on.baseToDerived
- The transform from the base CRS to returned CRS.derivedCS
- The coordinate system for the projected CRS. The number of axes must match the target dimension of the transformbaseToDerived
.- Throws:
MismatchedDimensionException
- if the source and target dimension ofbaseToDerived
don't match the dimension ofbase
andderivedCS
respectively.
-
-
Method Detail
-
getCoordinateSystem
public CartesianCS getCoordinateSystem()
Returns the coordinate system.- Specified by:
getCoordinateSystem
in interfaceCoordinateReferenceSystem
- Specified by:
getCoordinateSystem
in interfaceProjectedCRS
- Specified by:
getCoordinateSystem
in interfaceSingleCRS
- Overrides:
getCoordinateSystem
in classAbstractCRS
- Returns:
- The coordinate system.
-
getDatum
public GeodeticDatum getDatum()
Returns the datum.- Specified by:
getDatum
in interfaceProjectedCRS
- Specified by:
getDatum
in interfaceSingleCRS
- Overrides:
getDatum
in classAbstractSingleCRS
- Returns:
- The datum.
-
getBaseCRS
public GeographicCRS getBaseCRS()
Returns the base coordinate reference system, which must be geographic.- Specified by:
getBaseCRS
in interfaceGeneralDerivedCRS
- Specified by:
getBaseCRS
in interfaceProjectedCRS
- Overrides:
getBaseCRS
in classAbstractDerivedCRS
- Returns:
- The base CRS.
-
getConversionFromBase
public Projection getConversionFromBase()
Returns the map projection from the base CRS to this CRS.- Specified by:
getConversionFromBase
in interfaceGeneralDerivedCRS
- Specified by:
getConversionFromBase
in interfaceProjectedCRS
- Overrides:
getConversionFromBase
in classAbstractDerivedCRS
- Returns:
- The map projection from base CRS to this CRS.
-
calculateHashCode
public int calculateHashCode()
Returns a hash value for this projected CRS.- Overrides:
calculateHashCode
in classAbstractDerivedCRS
- Returns:
- The hash code value. This value doesn't need to be the same in past or future versions of this class.
-
formatWKT
protected String formatWKT(Formatter formatter)
Format the inner part of a Well Known Text (WKT) element.- Overrides:
formatWKT
in classAbstractDerivedCRS
- Parameters:
formatter
- The formatter to use.- Returns:
- The name of the WKT element type, which is
"PROJCS"
. - See Also:
Formattable.toWKT()
,Formattable.toString()
-
formatPROJ
public String formatPROJ(PROJFormatter formatter)
Description copied from interface:PROJFormattable
Format the inner part of a PROJFormattable object.This method is automatically invoked by
PROJFormatter.append(PROJFormattable)
.For example for a element (
DefaultOperationMethod
) of type Projection, the formatter will invoke this method to prepend the "+proj=" String for completing the PROJ String before appending the Projection Name (e.g. lcc for a Lambert Conformal Conic)- Specified by:
formatPROJ
in interfacePROJFormattable
- Parameters:
formatter
- The PROJFormatter to use.- Returns:
- The proj String of the PROJ element type if any. (e.g. +ellps= for named ellipsoids, +datum= for named datums).
-
-