[MetaCRS] A Question About The Typical Method Of CRS Transformations

Martin Desruisseaux martin.desruisseaux at geomatys.fr
Thu May 15 08:04:34 PDT 2008


Landon Blake a écrit :
> I’d think the first scenario is the easiest to program, but the most 
> difficult to add CRS definitions too. (To add a definition would require 
> knowledge of the particular programming language used to implement the 
> library.)
> 
> In the second scenario the CRS code would be more complex, but a CRS 
> definition could be added with a simple text file.
> 
> Are there any thoughts on which approach is superior? Which approach is 
> used by existing CRS solutions?
> 
> Is a hybrid approach possible?


Not sure if it answer the question, but there is how GeoTools is organized:

* We implement a set of OperationMethod (an ISO 19111 class) for different
   projection using different geometries: Mercator, Lambert, Stereographic,
   etc. We have about 38 of such OperationMethods. Those OperationMethods
   accept arbitrary parameters like "central_meridian", etc. The set of
   available parameters is decided on an case-by-case basis.

* A ProjectedCRS (again an ISO 19111 class) contains an OperationMethod
   with a set of parameter values. So for example it contains the "Mercator"
   OperationMethod with the value to use for "central_meridian", etc.

The OperationMethods need to be hard-coded, because they contain formulas to be 
express in the target programming language. Fortunatly this usually need to be 
done only once for a large set of CRS. Even if new CRS using the "Mercator" 
projection come up with new datum, they are still using the same old "Mercator" 
method, only with different parameters.

The ProjectedCRS doesn't need hard-coded parameter values and can easily be 
created from a text file. When new CRS come up, we usually mean a new 
ProjectedCRS instance with existing OperationMethod but different parameters, so 
there is no new formulas to program - a text file is fine in the vast majority 
of cases.

	Martin



More information about the MetaCRS mailing list