The CoordinateTransformationFactory
class analyze source and target coordinate systems and try to build a
transformation path. It can swap axis order and orientation when necessary
(for example from ({@link org.geotools.cs.AxisOrientation#NORTH NORTH},{@link org.geotools.cs.AxisOrientation#WEST WEST})
to ({@link org.geotools.cs.AxisOrientation#EAST EAST},{@link org.geotools.cs.AxisOrientation#NORTH NORTH})),
apply units conversions and of course performs map projections.
CoordinateTransformationFactory
is
a kind of high-level API. User wanting more control on transformation creation
can use a low-level API: {@link org.geotools.ct.MathTransformFactory}. For example,
a mercator cylindrical projection can be created by the following
code:
{@link org.geotools.ct.MathTransformFactory} factory = MathTransformFactory.getDefault(); {@link javax.media.jai.ParameterList} parameters = factory.getMathTransformProvider("Mercator_1SP").getParameterList(); parameters.setParameter("semi_major", 6378137.0); parameters.setParameter("semi_minor", 6356752.314); {@link org.geotools.ct.MathTransform} projection = factory.createParameterizedTransform(parameters);
The "Mercator_1SP" string is the classification name for the mercator cylindrical projection. This package support the following classification names:
Classification | EPSG code |
---|---|
Affine | |
Geocentric_To_Ellipsoid | 9602 |
Ellipsoid_To_Geocentric | 9602 |
Lambert_Conformal_Conic_1SP | 9801 |
Lambert_Conformal_Conic_2SP | 9802 |
Mercator_1SP | 9804 |
Mercator_2SP | 9805 |
Transverse_Mercator | 9807 |
Oblique_Stereographic | 9809 |
Polar_Stereographic | 9810 |
Albers_Conic_Equal_Area | 9822 |
org.geotools.ct.TransformException
need to be replaced by
org.opengis.referencing.operation.TransformException
.org.geotools.ct.NoninvertibleTransformException
need to be replaced by
org.opengis.referencing.operation.NoninvertibleTransformException
.