 All Superinterfaces:
Factory
MathTransformFactory
interface can be used directly
by applications that wish to transform other types of coordinates (e.g. color coordinates,
or image pixel coordinates).
A math transform is an object that actually does
the work of applying formulae to coordinate values. The math transform does
not know or care how the coordinates relate to positions in the real world.
This lack of semantics makes implementing MathTransformFactory
significantly easier than it would be otherwise.
For example the affine transform applies a matrix to the coordinates without knowing how what it is doing relates to the real world. So if the matrix scales Z values by a factor of 1000, then it could be converting meters into millimeters, or it could be converting kilometers into meters.
Because math transforms have low semantic value
(but high mathematical value), programmers who do not have much knowledge
of how GIS applications use coordinate systems, or how those coordinate
systems relate to the real world can implement MathTransformFactory
.
The low semantic content of math transforms also
means that they will be useful in applications that have nothing to do with
GIS coordinates. For example, a math transform could be used to map color
coordinates between different color spaces, such as converting (red, green, blue)
colors into (hue, light, saturation) colors.
Since a math transform does not know what its source and target coordinate systems mean, it is not necessary or desirable for a math transform object to keep information on its source and target coordinate systems.
 Since:
 1.0
 See Also:

Method Summary
Modifier and TypeMethodDescriptioncreateAffineTransform
(Matrix matrix) Creates an affine transform from a matrix.createBaseToDerived
(CoordinateReferenceSystem baseCRS, ParameterValueGroup parameters, CoordinateSystem derivedCS) Creates a parameterized transform from a base CRS to a derived CS.createConcatenatedTransform
(MathTransform transform1, MathTransform transform2) Creates a transform by concatenating two existing transforms.createFromWKT
(String wkt) Creates a math transform object from a string.createFromXML
(String xml) Creates a math transform object from a XML string.createParameterizedTransform
(ParameterValueGroup parameters) Creates a transform from a group of parameters.createPassThroughTransform
(int firstAffectedOrdinate, MathTransform subTransform, int numTrailingOrdinates) Creates a transform which passes through a subset of ordinates to another transform.getAvailableMethods
(Class<? extends SingleOperation> type) Returns a set of available methods for math transforms.getDefaultParameters
(String method) Returns the default parameter values for a math transform using the given method.Returns the operation method used for the latest call tocreateParameterizedTransform
, ornull
if not applicable.

Method Details

getAvailableMethods
Returns a set of available methods for math transforms. For each element in this set, the operation method name must be known to thegetDefaultParameters(String)
method in this factory. The set of available methods is implementation dependent. Parameters:
type
SingleOperation.class
for fetching all operation methods, orProjection.class
for fetching only map projection methods. Returns:
 All math transform methods available in this factory.
 See Also:
 Departure from OGC/ISO abstract specification:
Addition of element not in the ISO/OGC specification
This method is not part of the OGC specification. It has been added as a way to publish the capabilities of a factory.

getLastMethodUsed
OperationMethod getLastMethodUsed()Returns the operation method used for the latest call tocreateParameterizedTransform
, ornull
if not applicable.Implementors should document how their implementation behave in a multithreads environment. For example some implementations use thread local variables, while other can choose to returns
null
in all cases since this method is optional.Note that this method may apply as well to convenience methods that delegate their work to
createParameterizedTransform
, likecreateBaseToDerived
. Returns:
 The last method used, or
null
if unknown of unsupported.  Since:
 2.1
 Departure from OGC/ISO abstract specification:
Addition of element not in the ISO/OGC specification
This method is not part of the OGC specification. It has been added because this information appears to be needed in practice. A more objectoriented approach would have been to return a {MathTransform
,OperationMethod
} tuple in thecreateParameterizedTransform()
method, but we wanted to keep the later unchanged for historical reasons (it is inherited from OGC 01009) and because only a minority of use cases need the operation method.Note that the existence of this method does not break threadsafety if the implementor stores this information in a
ThreadLocal
variable.

getDefaultParameters
Returns the default parameter values for a math transform using the given method. Themethod
argument is the name of any operation method returned by
. A typical example isgetAvailableMethods
(CoordinateOperation.class)"Transverse_Mercator"
).The parameter group name shall be the method name, or an alias to be understood by
createParameterizedTransform(parameters)
. This method creates new parameter instances at every call. Parameters are intended to be modified by the user before to be given to the abovecitedcreateParameterizedTransform
method. Parameters:
method
 The case insensitive name of the method to search for. Returns:
 The default parameter values.
 Throws:
NoSuchIdentifierException
 if there is no transform registered for the specified method. See Also:
 Departure from OGC/ISO abstract specification:
Addition of element not in the ISO/OGC specification
This method is part of the GeoAPI mechanism for defining the math transform parameters or deriving other transforms.

createBaseToDerived
MathTransform createBaseToDerived(CoordinateReferenceSystem baseCRS, ParameterValueGroup parameters, CoordinateSystem derivedCS) throws NoSuchIdentifierException, FactoryException Creates a parameterized transform from a base CRS to a derived CS. This convenience method concatenates the parameterized transform with any other transform required for performing units changes and ordinates swapping, as described in the note on cartographic projections.In addition, implementations are encouraged to infer the
"semi_major"
and"semi_minor"
parameter values from the ellipsoid, if they are not explicitly given. Parameters:
baseCRS
 The source coordinate reference system.parameters
 The parameter values for the transform.derivedCS
 The target coordinate system. Returns:
 The parameterized transform.
 Throws:
NoSuchIdentifierException
 if there is no transform registered for the method.FactoryException
 if the object creation failed. This exception is thrown if some required parameter has not been supplied, or has illegal value. Since:
 2.1
 Departure from OGC/ISO abstract specification:
Addition of element not in the ISO/OGC specification
This method is part of the GeoAPI mechanism for defining the math transform parameters or deriving other transforms.

createParameterizedTransform
@UML(identifier="createParameterizedTransform", obligation=MANDATORY, specification=OGC_01009) MathTransform createParameterizedTransform(ParameterValueGroup parameters) throws NoSuchIdentifierException, FactoryException Creates a transform from a group of parameters. The method name is inferred from the parameter group name. Example:
Note on cartographic projections:ParameterValueGroup p = factory.getDefaultParameters("Transverse_Mercator"); p.parameter("semi_major").setValue(6378137.000); p.parameter("semi_minor").setValue(6356752.314); MathTransform mt = factory.createParameterizedTransform(p);
Cartographic projection transforms are used by projected coordinate reference systems to map geographic coordinates (e.g. longitude and latitude) into (x,y) coordinates. These (x,y) coordinates can be imagined to lie on a plane, such as a paper map or a screen. All cartographic projection transforms created through this method will have the following properties:
 Converts from (longitude,latitude) coordinates to (x,y).
 All angles are assumed to be degrees, and all distances are assumed to be meters.
 The domain shall be a subset of {[180,180)×(90,90)}.
Although all cartographic projection transforms must have the properties listed above, many projected coordinate reference systems have different properties. For example, in Europe some projected CRSs use grads instead of degrees, and often the base geographic CRS is (latitude, longitude) instead of (longitude, latitude). This means that the cartographic projected transform is often used as a single step in a series of transforms, where the other steps change units and swap ordinates.
 Parameters:
parameters
 The parameter values. Returns:
 The parameterized transform.
 Throws:
NoSuchIdentifierException
 if there is no transform registered for the method.FactoryException
 if the object creation failed. This exception is thrown if some required parameter has not been supplied, or has illegal value. See Also:

createAffineTransform
@UML(identifier="createAffineTransform", obligation=MANDATORY, specification=OGC_01009) MathTransform createAffineTransform(Matrix matrix) throws FactoryException Creates an affine transform from a matrix. If the transform's input dimension isM
, and output dimension isN
, then the matrix will have size[N+1][M+1]
. The +1 in the matrix dimensions allows the matrix to do a shift, as well as a rotation. The[M][j]
element of the matrix will be the j'th ordinate of the moved origin. The[i][N]
element of the matrix will be 0 for i less thanM
, and 1 for i equalsM
. Parameters:
matrix
 The matrix used to define the affine transform. Returns:
 The affine transform.
 Throws:
FactoryException
 if the object creation failed.

createConcatenatedTransform
@UML(identifier="createConcatenatedTransform", obligation=MANDATORY, specification=OGC_01009) MathTransform createConcatenatedTransform(MathTransform transform1, MathTransform transform2) throws FactoryException Creates a transform by concatenating two existing transforms. A concatenated transform acts in the same way as applying two transforms, one after the other. The dimension of the output space of the first transform must match the dimension of the input space in the second transform. If you wish to concatenate more than two transforms, then you can repeatedly use this method. Parameters:
transform1
 The first transform to apply to points.transform2
 The second transform to apply to points. Returns:
 The concatenated transform.
 Throws:
FactoryException
 if the object creation failed.

createPassThroughTransform
@UML(identifier="createPassThroughTransform", obligation=MANDATORY, specification=OGC_01009) MathTransform createPassThroughTransform(int firstAffectedOrdinate, MathTransform subTransform, int numTrailingOrdinates) throws FactoryException Creates a transform which passes through a subset of ordinates to another transform. This allows transforms to operate on a subset of ordinates. For example giving (latitude, longitude, height) coordinates, a pass through transform can convert the height values from meters to feet without affecting the (latitude, longitude) values. Parameters:
firstAffectedOrdinate
 The lowest index of the affected ordinates.subTransform
 Transform to use for affected ordinates.numTrailingOrdinates
 Number of trailing ordinates to pass through. Affected ordinates will range fromfirstAffectedOrdinate
inclusive todimTargetnumTrailingOrdinates
exclusive. Returns:
 A pass through transform with the following dimensions:
Source: firstAffectedOrdinate + subTransform.getDimSource() + numTrailingOrdinates Target: firstAffectedOrdinate + subTransform.getDimTarget() + numTrailingOrdinates
 Throws:
FactoryException
 if the object creation failed.

createFromXML
@UML(identifier="createFromXML", obligation=MANDATORY, specification=OGC_01009) MathTransform createFromXML(String xml) throws FactoryException Creates a math transform object from a XML string. Parameters:
xml
 Math transform encoded in XML format. Returns:
 The math transform (never
null
).  Throws:
FactoryException
 if the object creation failed.

createFromWKT
@UML(identifier="createFromWKT", obligation=MANDATORY, specification=OGC_01009) MathTransform createFromWKT(String wkt) throws FactoryException Creates a math transform object from a string. The definition for WKT is shown using Extended Backus Naur Form (EBNF). Parameters:
wkt
 Math transform encoded in WellKnown Text format. Returns:
 The math transform (never
null
).  Throws:
FactoryException
 if the WellKnown Text can't be parsed, or if the math transform creation failed from some other reason.
