[geotk] Custom projection math transform

Martin Desruisseaux martin.desruisseaux at geomatys.fr
Thu Oct 1 09:34:23 EDT 2009


Hello Sam

Sam B a écrit :
> He also mentionned about the MathTransform (which is what I currently 
> need). I just don't understand a few things : I guess the MathTransform 
> needs to know the source AND the target CRS, am I wrong ? Because, on 
> the previous post, Martin only told about defining a source CRS...

The MathTransform object itself has no notion of any CRS, neither source or 
target. It is just an implementation of a mathematical function which could be 
applying a transformation between any kind of space, not necessarly geodetic. It 
could be a transformation between color spaces for example. This is not an 
accident if this interface doesn't have to word "Coordinate" in its name.

CoordinateOperation on the other hand is a higher level construct. This one know 
both the source and target CRS. CoordinateOperation wraps a MathTransform, ading 
geodetic knowledge to it and delegating the actual transformation work to 
MathTransform.

So if you create the MathTransform using the CoordinateOperationFactory methods, 
then you need both the source and target CRS, as you rightly guessed. This is 
the "high level" approach from a geographic point of view. But if you create a 
MathTransform directly (which is the "low level" approach), then the source and 
target CRS are assumed known to the creator, which is responsible for 
calculating the right parameters (e.g. the coefficients to put in an affine 
transform) from the source and target CRS. The MathTransform itself care only 
about those parameters - the source and target CRS are irrelevant to it.

	Martin


More information about the Geotoolkit mailing list