|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectStatic
CRS
public final class CRS
Simple utility class for making use of the Coordinate Reference System and associated Factory implementations. This utility class is made up of static functions working with arbitrary implementations of GeoAPI interfaces as much as possible.
The methods defined in this class can be grouped in three categories:
decode(String).isHorizontalCRS(CoordinateReferenceSystem).transform(CoordinateOperation,Envelope).
| referencing/geotk-referencing (download) | View source code for this class |
| Method Summary | |
|---|---|
static CoordinateReferenceSystem |
decode(String code)
Returns a Coordinate Reference System for the specified code. |
static CoordinateReferenceSystem |
decode(String code,
boolean longitudeFirst)
Returns a Coordinate Reference System for the specified code, maybe forcing the axis order to (longitude, latitude). |
static double[] |
deltaTransform(MathTransform transform,
DirectPosition origin,
double... vector)
Transforms the given relative distance using the given transform. |
static boolean |
equalsApproximatively(Object object1,
Object object2)
Compares the specified objects for equality, ignoring metadata and slight differences in numerical values. |
static boolean |
equalsIgnoreMetadata(Object object1,
Object object2)
Compares the specified objects for equality, ignoring metadata. |
static MathTransform |
findMathTransform(CoordinateReferenceSystem sourceCRS,
CoordinateReferenceSystem targetCRS)
Grabs a transform between two Coordinate Reference Systems. |
static MathTransform |
findMathTransform(CoordinateReferenceSystem sourceCRS,
CoordinateReferenceSystem targetCRS,
boolean lenient)
Grab a transform between two Coordinate Reference Systems. |
static CRSAuthorityFactory |
getAuthorityFactory(Boolean longitudeFirst)
Returns the CRS authority factory used by the decode methods. |
static CompoundCRS |
getCompoundCRS(CompoundCRS crs,
SingleCRS... components)
Returns the first compound CRS which contains only the given components, in any order. |
static CoordinateOperationFactory |
getCoordinateOperationFactory(boolean lenient)
Returns the coordinate operation factory used by findMathTransform convenience methods. |
static Datum |
getDatum(CoordinateReferenceSystem crs)
Returns the datum of the specified CRS, or null if none. |
static String |
getDeclaredIdentifier(IdentifiedObject object)
Deprecated. Moved to IdentifiedObjects. |
static Ellipsoid |
getEllipsoid(CoordinateReferenceSystem crs)
Returns the first ellipsoid found in a coordinate reference system, or null if there is none. |
static Envelope |
getEnvelope(CoordinateReferenceSystem crs)
Returns the domain of validity for the specified coordinate reference system, or null if unknown. |
static GeographicBoundingBox |
getGeographicBoundingBox(CoordinateReferenceSystem crs)
Returns the valid geographic area for the specified coordinate reference system, or null if unknown. |
static SingleCRS |
getHorizontalCRS(CoordinateReferenceSystem crs)
Returns the first horizontal coordinate reference system found in the given CRS, or null if there is none. |
static ProjectedCRS |
getProjectedCRS(CoordinateReferenceSystem crs)
Returns the first projected coordinate reference system found in a the given CRS, or null if there is none. |
static CoordinateReferenceSystem |
getSubCRS(CoordinateReferenceSystem crs,
int lower,
int upper)
Returns the coordinate reference system in the given range of dimension indices. |
static Set<String> |
getSupportedAuthorities(boolean returnAliases)
Returns the set of the authority identifiers supported by registered authority factories. |
static Set<String> |
getSupportedCodes(String authority)
Gets the list of the codes that are supported by the given authority. |
static TemporalCRS |
getTemporalCRS(CoordinateReferenceSystem crs)
Returns the first temporal coordinate reference system found in the given CRS, or null if there is none. |
static Version |
getVersion(String authority)
Returns the version number of the specified authority database, or null if
not available. |
static VerticalCRS |
getVerticalCRS(CoordinateReferenceSystem crs)
Returns the first vertical coordinate reference system found in a the given CRS, or null if there is none. |
static boolean |
isHorizontalCRS(CoordinateReferenceSystem crs)
Returns true if the given CRS is horizontal. |
static Integer |
lookupEpsgCode(CoordinateReferenceSystem crs,
boolean fullScan)
Deprecated. Moved to IdentifiedObjects. |
static String |
lookupIdentifier(Citation authority,
CoordinateReferenceSystem crs,
boolean fullScan)
Deprecated. Moved to IdentifiedObjects. |
static String |
lookupIdentifier(IdentifiedObject object,
boolean fullScan)
Deprecated. Moved to IdentifiedObjects. |
static CoordinateReferenceSystem |
parseWKT(String wkt)
Parses a Well Known Text (WKT) into a CRS object. |
static void |
reset(String aspects)
Resets some aspects of the referencing system. |
static GeneralEnvelope |
transform(CoordinateOperation operation,
Envelope envelope)
Transforms an envelope using the given coordinate operation. |
static Rectangle2D |
transform(CoordinateOperation operation,
Rectangle2D envelope,
Rectangle2D destination)
Transforms a rectangular envelope using the given coordinate operation. |
static Envelope |
transform(Envelope envelope,
CoordinateReferenceSystem targetCRS)
Transforms the given envelope to the specified CRS. |
static Rectangle2D |
transform(MathTransform2D transform,
Rectangle2D envelope,
Rectangle2D destination)
Transforms a rectangular envelope using the given math transform. |
static GeneralEnvelope |
transform(MathTransform transform,
Envelope envelope)
Transforms an envelope using the given math transform. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static CRSAuthorityFactory getAuthorityFactory(Boolean longitudeFirst)
throws FactoryRegistryException
decode methods.
This factory uses a cache,
scans over all factories and
uses additional factories as fallbacks if there is more than one registered factory for the same authority.
This factory can be used as a kind of system-wide factory for all authorities.
However for more determinist behavior, consider using a more specific factory (as returned
by AuthorityFactoryFinder.getCRSAuthorityFactory(java.lang.String, org.geotoolkit.factory.Hints)) when the authority is known.
longitudeFirst - true if axis order should be forced to
(longitude, latitude), false if no order should be
forced (i.e. the standard specified by the authority is respected), or null
for the system default.
FactoryRegistryException - if the factory can't be created.Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDERpublic static CoordinateOperationFactory getCoordinateOperationFactory(boolean lenient)
findMathTransform convenience methods.
lenient - true if the coordinate operations should be created
even when there is no information available for a datum shift.
public static Version getVersion(String authority)
throws FactoryRegistryException
null if
not available.
authority - The authority name (typically "EPSG").
null if unknown.
FactoryRegistryException - if no CRSAuthorityFactory implementation
was found for the specified authority.public static Set<String> getSupportedCodes(String authority)
getSupportedCodes("EPSG") may returns "EPSG:2000", "EPSG:2001",
"EPSG:2002", etc. It may also returns "2000", "2001",
"2002", etc. without the "EPSG:" prefix. Whatever the authority
name is prefixed or not is factory implementation dependent.
If there is more than one factory for the given authority, then this method merges the code set of all of them. If a factory fails to provide a set of supported code, then this particular factory is ignored. Please be aware of the following potential issues:
"4326" and
"EPSG:4326"), then the returned set will contain a lot of synonymous
codes.decode(c) will use the same authority
factory than the one that formatted c.FactoryExceptions are logged as warnings and otherwise ignored.If a more determinist behavior is wanted, consider the code below instead. The following code exploit only one factory, the "preferred" one.
factory = AuthorityFactoryFinder.getCRSAuthorityFactory(authority, null); Set<String> codes = factory.getAuthorityCodes(CoordinateReferenceSystem.class); String code = ... // Choose a code here. CoordinateReferenceSystem crs = factory.createCoordinateReferenceSystem(code);
authority - The authority name (for example "EPSG").
public static Set<String> getSupportedAuthorities(boolean returnAliases)
returnAliases - If true, the set will contain all identifiers for each
authority. If false, only the first one
public static CoordinateReferenceSystem decode(String code)
throws NoSuchAuthorityCodeException,
FactoryException
EPSG:4326AUTO:42001,9001,0,30If there is more than one factory implementation for the same authority, then all additional factories are fallbacks to be used only when the first acceptable factory failed to create the requested CRS object.
Common codes
A few commonly used codes are:
Caching
CRS objects created by previous calls to this method are
cached
using weak references. Subsequent calls to this
method with the same authority code should be fast, unless the CRS object has been garbage
collected.
code - The Coordinate Reference System authority code.
NoSuchAuthorityCodeException - If the code could not be understood.
FactoryException - if the CRS creation failed for an other reason.getSupportedCodes(String),
Units.valueOfEPSG(int),
List of authority codes
public static CoordinateReferenceSystem decode(String code,
boolean longitudeFirst)
throws NoSuchAuthorityCodeException,
FactoryException
code argument value is parsed
as in decode(code). The longitudeFirst
argument is the value to be given to the FORCE_LONGITUDE_FIRST_AXIS_ORDER hint.
Example: by default, CRS.decode("EPSG:4326") returns a Geographic CRS with
(latitude, longitude) axis order, while CRS.decode("EPSG:4326", true)
returns the same CRS except for axis order, which is (longitude, latitude).
code - The Coordinate Reference System authority code.longitudeFirst - true if axis order should be forced to
(longitude, latitude), false if no order should
be forced (i.e. the standard specified by the authority is respected).
NoSuchAuthorityCodeException - If the code could not be understood.
FactoryException - if the CRS creation failed for an other reason.Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER,
LongitudeFirstEpsgFactory,
List of authority codes
public static CoordinateReferenceSystem parseWKT(String wkt)
throws FactoryException
FactoryFinder.getCRSFactory(null).createFromWKT(wkt);
wkt - The WKT string to parse.
FactoryException - if the given WKT can't be parsed.public static Envelope getEnvelope(CoordinateReferenceSystem crs)
null if unknown.
This method fetches the domain
of validity associated with the given CRS. Only geographic
extents of kind bounding polygon are taken in account. If
none are found, then the geographic bounding boxes
are used as a fallback.
The returned envelope is expressed in terms of the specified CRS.
crs - The coordinate reference system, or null.
null if none.getGeographicBoundingBox(CoordinateReferenceSystem),
GeneralEnvelope.reduceToDomain(boolean)public static GeographicBoundingBox getGeographicBoundingBox(CoordinateReferenceSystem crs)
null if unknown.
This method fetches the domain
of validity associated with the given CRS. Only geographic
extents of kind geographic bounding box are taken in
account.
crs - The coordinate reference system, or null.
null if none.getEnvelope(CoordinateReferenceSystem)public static boolean isHorizontalCRS(CoordinateReferenceSystem crs)
true if the given CRS is horizontal. This method is provided because there is
a direct way to determine if a CRS is vertical or temporal, but no direct way to determine if
it is horizontal. So this method complements the check for spatio-temporal components as below:
if (crs instanceof TemporalCRS) determines if the CRS is for the temporal component.if (crs instanceof VerticalCRS) determines if the CRS is for the vertical component.if (CRS.isHorizontalCRS(crs)) determines if the CRS is for the horizontal component.This method considers a CRS as horizontal if it is two-dimensional and comply with one of the following conditions:
GeographicCRS.ProjectedCRS (actually this is not explicitly
checked, since this condition is a special case of the condition below).GeneralDerivedCRS based on a horizontal CRS
and using a GeodeticDatum.
The last condition (GeneralDerivedCRS based on a horizontal CRS) allows for example
to express the coordinates of a projected CRS (which use a Cartesian coordinate system) in
a polar coordinate system and still consider
the result as horizontal. However this assumes that the axes of the derived CRS are coplanar
with the axes of the base CRS. This is not always true since a derived CRS could be created
for an inclined plane, for example a plane fitting the slope of a mountain. ISO 19111 does
not specify how to handle this case. In the Geotk implementation, we suggest to define a new
datum for inclined plane which is not a geodetic datum.
crs - The coordinate reference system, or null.
true if the given CRS is non-null and comply with one of the above
conditions, or false otherwise.public static SingleCRS getHorizontalCRS(CoordinateReferenceSystem crs)
null if there is none. A horizontal CRS is usually a two-dimensional
geographic or projected CRS.
See the isHorizontalCRS method for
a more accurate description about the conditions for a CRS to be considered horizontal.
crs - The coordinate reference system, or null.
null if none.public static ProjectedCRS getProjectedCRS(CoordinateReferenceSystem crs)
null if there is none.
crs - The coordinate reference system, or null.
null if none.public static VerticalCRS getVerticalCRS(CoordinateReferenceSystem crs)
null if there is none.
crs - The coordinate reference system, or null.
null if none.public static TemporalCRS getTemporalCRS(CoordinateReferenceSystem crs)
null if there is none.
crs - The coordinate reference system, or null.
null if none.
public static CompoundCRS getCompoundCRS(CompoundCRS crs,
SingleCRS... components)
SingleCRS components of the given compound CRS. If
all those components are equal, ignoring metadata
and order, to the SingleCRS components given to this method, then the given
CompoundCRS is returned. Otherwise if the given CompoundCRS contains
nested CompoundCRS, then those nested CRS are inspected recursively by the same
algorithm. Otherwise, this method returns null.
This method is useful for extracting metadata about the 3D spatial CRS part in a 4D spatio-temporal CRS. For example given the following CRS:
COMPD_CS["Mercator + height + time",
COMPD_CS["Mercator + height",
PROJCS["Mercator", ...etc...]
VERT_CS["Ellipsoidal height", ...etc...]]
TemporalCRS["Modified Julian", ...etc...]]
Then the following code will returns the nested COMPD_CS["Mercator + height"]
without prior knowledge of the CRS component order (the time CRS could be first, and
the vertical CRS could be before the horizontal one):
CompoundCRS crs = ...;
SingleCRS horizontalCRS = getHorizontalCRS(crs);
VerticalCRS verticalCRS = getVerticalCRS(crs);
if (horizontalCRS != null && verticalCRS != null) {
CompoundCRS spatialCRS = getCompoundCRS(crs, horizontalCRS, verticalCRS);
if (spatialCRS != null) {
// ...
}
}
crs - The compound CRS to compare with the given component CRS, or null.components - The CRS which must be components of the returned CRS.
null if none.DefaultCompoundCRS.getSingleCRS()
public static CoordinateReferenceSystem getSubCRS(CoordinateReferenceSystem crs,
int lower,
int upper)
crs is null, then this method returns null.lower is 0 and upper if the number of CRS dimensions,
then this method returns the given CRS unchanged.CompoundCRS, then this method
searches for a component where:
upper - lower;lower.null.
This method does not attempt to build new CRS from the components.
For example it does not attempt to create a 3D geographic CRS from a 2D one + a vertical
component. If such functionality is desired, consider using the utility methods in
ReferencingFactoryContainer instead.
crs - The coordinate reference system to decompose, or null.lower - The first dimension to keep, inclusive.upper - The last dimension to keep, exclusive.
null if the given crs was null
or can't be decomposed for dimensions in the range [lower..upper].
IndexOutOfBoundsException - If the given index are out of bounds.ReferencingFactoryContainer.separate(CoordinateReferenceSystem, int[])public static Datum getDatum(CoordinateReferenceSystem crs)
null if none.
This method processes as below:
SingleCRS, then this method returns
crs.getDatum().CompoundCRS, then:
null.
crs - The coordinate reference system for which to get the datum. May be null.
null if none.getEllipsoid(CoordinateReferenceSystem)public static Ellipsoid getEllipsoid(CoordinateReferenceSystem crs)
null if there is none. More specifically:
SingleCRS and its datum is a
GeodeticDatum, then this method returns the datum ellipsoid.CompoundCRS, then this method
invokes itself recursively for each component until a geodetic datum is found.null.Note that this method does not check if there is more than one ellipsoid (it should never be the case).
crs - The coordinate reference system, or null.
null if none.getDatum(CoordinateReferenceSystem)@Deprecated public static String getDeclaredIdentifier(IdentifiedObject object)
IdentifiedObjects.
null if none. This method searches for the first
identifier (which is usually the main one) explicitly declared in the IdentifiedObject.
At the opposite of lookupIdentifier,
this method does not verify the identifier validity.
More specifically, this method uses the first non-null element found in
object.getIdentifiers(). If there
is none, then it uses object.getName() -
which is not guaranteed to be a valid identifier.
Recommanded alternatives
AbstractIdentifiedObject instead.
Note on Spatial Reference System (SRS) identifiers
OGC Web Services have the concept of a Spatial Reference System identifier used to
communicate CRS information between systems. In Well Known Text (WKT)
format, this identifier is declared in the AUTHORITY element.
Examples of Spatial Reference System (SRS) values:
EPSG:4326 - this was understood to mean force XY axis order in
old Web Map Services (WMS). Note that latest WMS specifications require the respect
of axis order as declared in the EPSG database, which is (latitude,
longitude).urn:ogc:def:crs:EPSG:4326 - understood to match the EPSG database axis order
in all cases, no matter the WMS version.AUTO:43200 - without the parameters that are specific to AUTO codes.
object - The identified object, or null.
null.lookupIdentifier(IdentifiedObject, boolean),
AbstractIdentifiedObject.getIdentifier(IdentifiedObject, Citation)
@Deprecated
public static String lookupIdentifier(IdentifiedObject object,
boolean fullScan)
throws FactoryException
IdentifiedObjects.
"EPSG:4326",
of the specified object. This method searches in registered factories for an object
approximatively equals to the specified
object. If such an object is found, then its first identifier is returned. Otherwise
this method returns null.
Note that this method checks the identifier validity. If the given object
declares explicitly an identifier, then this method will instantiate an object from the
authority factory using that identifier and compare it with the given object. If the
comparison fails, then this method returns null. Consequently this method may
returns null even if the given object declares explicitly its identifier. If
the declared identifier is wanted unconditionally, use
IdentifiedObjects.getIdentifier(IdentifiedObject) instead.
Recommanded alternatives
This convenience method delegates its work to IdentifiedObjectFinder. If you
want more control, consider using that class. For example, use that class if the search
should be performed only against some authority factories
instead of against all the registered factories, or if you want access to the full
identified object instead of only its string value.
object - The object (usually a coordinate
reference system) whose identifier is to be found.fullScan - If true, an exhaustive full scan against all registered objects
should be performed (may be slow). Otherwise only a fast lookup based on embedded
identifiers and names will be performed.
null if not found.
FactoryException - If an unexpected failure occurred during the search.AbstractAuthorityFactory.getIdentifiedObjectFinder(Class),
IdentifiedObjectFinder.findIdentifier(IdentifiedObject)
@Deprecated
public static String lookupIdentifier(Citation authority,
CoordinateReferenceSystem crs,
boolean fullScan)
throws FactoryException
IdentifiedObjects.
EPSG, of the specified CRS. Invoking this
method is similar to invoking
lookupIdentifier(object,
fullScan) except that the search is performed only among the factories of the given
authority.
Identifiers in URN and HTTP namespaces
Note that if the given authority is Citations.URN_OGC or Citations.HTTP_OGC,
then this method behaves as if the code was searched in all authority factories and the
result formatted in a "urn:ogc:def:" or
"http://www.opengis.net/gml/srs/" namespace.
authority - The authority for the code to search.crs - The Coordinate Reference System whose identifier is to be found, or null.fullScan - If true, an exhaustive full scan against all registered objects
should be performed (may be slow). Otherwise only a fast lookup based on embedded
identifiers and names will be performed.
null if none was found or if the given CRS was null.
FactoryException - If an unexpected failure occurred during the search.
public static Integer lookupEpsgCode(CoordinateReferenceSystem crs,
boolean fullScan)
throws FactoryException
IdentifiedObjects.
lookupIdentifier(EPSG, crs, fullScan) with the returned code parsed as an integer.
crs - The Coordinate Reference System whose identifier is to be found, or null.fullScan - If true, an exhaustive full scan against all registered objects
should be performed (may be slow). Otherwise only a fast lookup based on embedded
identifiers and names will be performed.
null if none was found or if the given CRS was null.
FactoryException - If an unexpected failure occurred during the search.
public static boolean equalsIgnoreMetadata(Object object1,
Object object2)
true, then:
If the two given objects are MathTransform instances, then transforming
a set of coordinate values using one transform will produce the same results than
transforming the same coordinates with the other transform.
If the two given objects are CoordinateReferenceSystem instances,
then a call to findMathTransform(crs1, crs2) will return
an identity transform.
equalsApproximatively(Object, Object) can be used instead.
Implementation note
If at least one object implements the LenientComparable interface, then this method
delegates to . The actual work of this convenience
method is performed by the following method call:
equals(…,
ComparisonMode.IGNORE_METADATA)
return Utilities.deepEquals(object1, object2, ComparisonMode.IGNORE_METADATA);
object1 - The first object to compare (may be null).object2 - The second object to compare (may be null).
true if both objects are equal, ignoring metadata.Utilities.deepEquals(Object, Object, ComparisonMode),
ComparisonMode.IGNORE_METADATA
public static boolean equalsApproximatively(Object object1,
Object object2)
true, then:
If the two given objects are MathTransform instances, then transforming a
set of coordinate values using one transform will produce approximatively
the same results than transforming the same coordinates with the other transform.
If the two given objects are CoordinateReferenceSystem instances,
then a call to findMathTransform(crs1, crs2) will return
a transform close to the identity transform.
Implementation note
If at least one object implements the LenientComparable interface, then this method
delegates to . The actual work of this convenience
method is performed by the following method call:
equals(…,
ComparisonMode.APPROXIMATIVE)
return Utilities.deepEquals(object1, object2, ComparisonMode.APPROXIMATIVE);
object1 - The first object to compare (may be null).object2 - The second object to compare (may be null).
true if both objects are approximatively equal.Utilities.deepEquals(Object, Object, ComparisonMode),
ComparisonMode.APPROXIMATIVE
public static MathTransform findMathTransform(CoordinateReferenceSystem sourceCRS,
CoordinateReferenceSystem targetCRS)
throws FactoryException
Note that some metadata like coordinate operation accuracy are lost by this method. If those metadata are wanted, use the coordinate operation factory directly.CoordinateOperationFactory factory = FactoryFinder.getCoordinateOperationFactory(null); CoordinateOperation operation = factory.createOperation(sourceCRS, targetCRS); MathTransform transform = operation.getMathTransform();
Sample use:
CoordinateReferenceSystem sourceCRS = CRS.decode("EPSG:42102");
CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:4326");
MathTransform transform = CRS.findMathTransform(sourceCRS, targetCRS);
sourceCRS - The source CRS.targetCRS - The target CRS.
sourceCRS to targetCRS.
FactoryException - If no math transform can be created for the specified source and
target CRS.
public static MathTransform findMathTransform(CoordinateReferenceSystem sourceCRS,
CoordinateReferenceSystem targetCRS,
boolean lenient)
throws FactoryException
findMathTransform(sourceCRS, targetCRS), except that it specifies whatever this
method should tolerate lenient datum shift. If the lenient argument
is true, then this method will not throw a "Bursa-Wolf parameters required"
exception during datum shifts if the Bursa-Wolf paramaters are not specified.
Instead it will assume a no datum shift.
sourceCRS - The source CRS.targetCRS - The target CRS.lenient - true if the math transform should be created even when there is
no information available for a datum shift. if this argument is not specified,
then the default value is determined from the system default.
sourceCRS to targetCRS.
FactoryException - If no math transform can be created for the specified source and
target CRS.Hints.LENIENT_DATUM_SHIFT
public static Envelope transform(Envelope envelope,
CoordinateReferenceSystem targetCRS)
throws TransformException
Don't use this method if there is many envelopes to transform. This method is provided as a convenience when there is only one envelope to transform between CRS that can't be known in advance. If there is many of them or if the CRS are restricted to known values, get the coordinate operation or math transform once for ever and invoke one of the methods below instead (unless if performance is not a concern).
envelope - The envelope to transform (may be null).targetCRS - The target CRS (may be null).
envelope
if no transformation was required.
TransformException - If a transformation was required and failed.
public static GeneralEnvelope transform(MathTransform transform,
Envelope envelope)
throws TransformException
Note that this method can not handle the case where the envelope contains the North or South
pole, or when it cross the ±180° longitude, because math transforms does not carry sufficient informations. For a more robust envelope
transformation, use transform(CoordinateOperation, Envelope) instead.
transform - The transform to use.envelope - Envelope to transform, or null. This envelope will not be modified.
null if envelope was null.
TransformException - if a transform failed.transform(CoordinateOperation, Envelope)
public static GeneralEnvelope transform(CoordinateOperation operation,
Envelope envelope)
throws TransformException
This method can handle the case where the envelope contains the North or South pole, or when it cross the ±180° longitude.
Note:
If the envelope CRS is non-null, then the caller should ensure that the operation
source CRS is the same than the envelope CRS. In case of mismatch, this method transforms
the envelope to the operation source CRS before to apply the operation. This extra step
may cause a lost of accuracy. In order to prevent this method from performing such
pre-transformation (if not desired), callers can ensure that the envelope CRS is
null before to call this method.
operation - The operation to use. Source and target dimension must be 2.envelope - Envelope to transform, or null. This envelope will not be modified.
null if envelope was null.
TransformException - if a transform failed.transform(MathTransform, Envelope)
public static Rectangle2D transform(MathTransform2D transform,
Rectangle2D envelope,
Rectangle2D destination)
throws TransformException
transform(transform, new GeneralEnvelope(envelope)).toRectangle2D()
Note that this method can not handle the case where the rectangle contains the North or South
pole, or when it cross the ±180° longitude, because math transforms do not carry sufficient informations. For a more robust rectangle
transformation, use transform(CoordinateOperation, Rectangle2D, Rectangle2D)
instead.
transform - The transform to use. Source and target dimension must be 2.envelope - The rectangle to transform (may be null).destination - The destination rectangle (may be envelope).
If null, a new rectangle will be created and returned.
destination, or a new rectangle if destination was non-null
and envelope was null.
TransformException - if a transform failed.transform(CoordinateOperation, Rectangle2D, Rectangle2D),
XAffineTransform.transform(AffineTransform, Rectangle2D, Rectangle2D)
public static Rectangle2D transform(CoordinateOperation operation,
Rectangle2D envelope,
Rectangle2D destination)
throws TransformException
This method can handle the case where the rectangle contains the North or South pole, or when it cross the ±180° longitude.transform(operation, new GeneralEnvelope(envelope)).toRectangle2D()
operation - The operation to use. Source and target dimension must be 2.envelope - The rectangle to transform (may be null).destination - The destination rectangle (may be envelope).
If null, a new rectangle will be created and returned.
destination, or a new rectangle if destination was non-null
and envelope was null.
TransformException - if a transform failed.transform(MathTransform2D, Rectangle2D, Rectangle2D),
XAffineTransform.transform(AffineTransform, Rectangle2D, Rectangle2D)
public static double[] deltaTransform(MathTransform transform,
DirectPosition origin,
double... vector)
throws TransformException
origin parameter in units
of the source CRS.
transform - The transformation to apply.origin - The position where to compute the delta transform in the source CRS.vector - The distance vector to be delta transformed.
TransformException - if the transformation failed.AffineTransform.deltaTransform(Point2D, Point2D)public static void reset(String aspects)
"plugins" for searching
the classpath for new plugins."warnings" for re-enabling the
warnings to be issued when a coordinate is out of geographic valid area.
aspects - The aspects to reset, or "all" for all of them.
Unknown aspects are silently ignored.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||