|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.referencing.CRS
Simple utility class for making use of the CoordinateReferenceSystem
and associated Factory
implementations.
This utility class is made up of static final functions. This class is
not a Factory or a Builder. It makes use of the GeoAPI Factory interfaces
provided by FactoryFinder
in the most direct manner possible.
The following methods may be added in a future version:
Nested Class Summary | |
static interface |
CRS.OperationVisitor
Deprecated. No public API uses this interface at this time. If a particular CoordinateOperationFactory implementation is wanted, try
to provide a Hints.COORDINATE_OPERATION_FACTORY hint to the
FactoryFinder.getCoordinateOperationFactory(org.geotools.factory.Hints) method instead.
In a future version, this interface will be removed or expanded if
the hints way is not suffisient. |
Method Summary | |
static org.opengis.referencing.crs.CoordinateReferenceSystem |
decode(java.lang.String code)
Return a Coordinate Reference System for the specified code. |
static boolean |
equalsIgnoreMetadata(java.lang.Object object1,
java.lang.Object object2)
Compares the specified objects for equality. |
static org.opengis.spatialschema.geometry.Envelope |
getEnvelope(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Returns the valid area bounding box for the specified coordinate reference system, or if unknown. |
static org.opengis.metadata.extent.GeographicBoundingBox |
getGeographicBoundingBox(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Returns the valid geographic area for the specified coordinate reference system, or if unknown. |
static java.util.Set |
getSupportedCodes(java.lang.String authority)
Get the list of the codes that are supported by the given authority. |
static org.opengis.referencing.crs.CoordinateReferenceSystem |
parseWKT(java.lang.String wkt)
Parses a Well Known Text (WKT) into a CRS object. |
static org.opengis.referencing.operation.MathTransform |
transform(org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS,
org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS)
Grab a transform between two Coordinate Reference Systems. |
static org.opengis.referencing.operation.MathTransform |
transform(org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS,
org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS,
boolean lenient)
Grab a transform between two Coordinate Reference Systems. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static boolean equalsIgnoreMetadata(java.lang.Object object1, java.lang.Object object2)
AbstractIdentifiedObject
, then this method
will ignore the metadata during the comparaison.
object1
- The first object to compare (may be null).object2
- The second object to compare (may be null).
public static org.opengis.referencing.operation.MathTransform transform(org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS, org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS) throws org.opengis.referencing.FactoryException
FactoryFinder.getCoordinateOperationFactory(null).createOperation(sourceCRS, targetCRS).getMathTransform();
Sample use:
MathTransform transform = CRS.transform(
CRS.decode("EPSG:42102"),
CRS.decode("EPSG:4326") );
sourceCRS
- The source CRS.targetCRS
- The target CRS.
org.opengis.referencing.FactoryException
- If no math transform can be created for the specified source and
target CRS.public static org.opengis.referencing.operation.MathTransform transform(org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS, org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS, boolean lenient) throws org.opengis.referencing.FactoryException
transform(sourceCRS, targetCRS)
, except that it can optionally tolerate
lenient datum shift. If the argument is ,
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
- if the math transform should be created even when there is
no information available for a datum shift. The default value is .
org.opengis.referencing.FactoryException
- If no math transform can be created for the specified source and
target CRS.public static java.util.Set getSupportedCodes(java.lang.String authority)
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:
decode(c)
will use the same authority
factory than the one that formatted c.FactoryException
s 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.
CRSAuthorityFactory factory = FactoryFinder.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 ).
public static org.opengis.referencing.crs.CoordinateReferenceSystem decode(java.lang.String code) throws org.opengis.referencing.NoSuchAuthorityCodeException
If there is more than one factory implementation for the same authority, then this method tries all of them in their iteration order and returns the first successfully created CRS.EPSG:1234 AUTO:42001, ..., ..., ...
NOTE: The AllAuthoritiesFactory
class provides similar functionality
as an CRSAuthorityFactory
implementation. It allows the same client code to work with
either a specific authority, or all available authorities, at user choice. A call to this
method maps approximatively to the following code:
AllAuthoritiesFactory.DEFAULT.createCoordinateReferenceSystem(code)
The main difference is that uses only the "preferred"
implementation for each authority, while this method tries every
implementations. Using only the preferred implementation way save class loading
and database connections if more than one EPSG database are availables (for example
an Access and a
PostgreSQL ones)
and their content are expected identical.
code
- The Coordinate Reference System authority code.
org.opengis.referencing.NoSuchAuthorityCodeException
- If the code could not be understood.
org.opengis.referencing.FactoryException
- if the CRS creation failed for an other reason.getSupportedCodes(java.lang.String)
,
AllAuthoritiesFactory.createCoordinateReferenceSystem(java.lang.String)
public static org.opengis.referencing.crs.CoordinateReferenceSystem parseWKT(java.lang.String wkt) throws org.opengis.referencing.FactoryException
FactoryFinder.getCRSFactory(null).createFromWKT(wkt);
org.opengis.referencing.FactoryException
public static org.opengis.spatialschema.geometry.Envelope getEnvelope(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
crs
- The coordinate reference system, or .
public static org.opengis.metadata.extent.GeographicBoundingBox getGeographicBoundingBox(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
crs
- The coordinate reference system, or .
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |