[geotk] Tranforms created in jboss and eclipse are different

Martin Desruisseaux martin.desruisseaux at geomatys.fr
Tue Nov 9 05:36:46 EST 2010

Hello Bertrik

Le 09/11/10 10:34, Bertrik Sikken a écrit :
> I noticed that when converting coordinates between ETRS89 (UTM31N) and ED50
> (UTM31N) I get slightly different results depending on the environment I’m
> running in. Coordinates converted when running in jboss are a few meters off
> compared to coordinates converted when running in Eclipse.
> I’m importing the coordinate systems using method CRS.parseWKT and creating the
> transform using CRS.findMathTransform(crsSource, crsTarget, false), so with lenient
> mode explicitly turned off.
> On closer inspection, I found that the transforms created to do the conversion
> are different.
> The transform created when running in Eclipse contains a “PARAM_MT["Affine …”
> step, while the one created
> in jboss contains a PARAM_MT["Position Vector transformation (geog2D domain)…"
> step, but are identical otherwise.
> Can anyone explain why I’m seeing two different transforms?

The EPSG database is not only a collection of CRS. For some coordinate 
operations, the EPSG database also specifies explicitly which operation methods 
shall be applied.

In the JBoss case, the referencing module has been able to etablish a connection 
to the EPSG database. The "Position Vector transformation (geog2D domain)" 
operation method come from the EPSG database. This information overwrite any 
"TOWGS84" elements in WKT.

In the Eclipse case, no such connection to the EPSG database has been 
etablished. Consequently the referencing module has build its own transformation 
chain using the Bursa-Wolf parameters provided by the "TOWGS84" elements that 
appear in the WKT of source and target CRS.

Many different values are possible for the "TOWGS84" elements for the same CRS. 
Geotk tries to guess a set of parameters on a "best effort" basis, but the 
choice is not always optimal (see http://jira.geotoolkit.org/browse/GEOTK-80). 
It depends on the pair of (source, target) CRS, on the geographic area where 
transformation are going to be applied, etc.

In any case, when the method is explicitly specified by the EPSG database, this 
is the authoritative method for that pair of (source, target) CRS.

> Is there a way to force one of these transforms (preferably the affine transform)?

Actually I would rather suggest the "Position Vector transformation", which is 
probably the correct one.

In Eclipse, just add a dependency to one of the following JDBC driver, at your 
choice. There is nothing to change in Geotk dependencies, it should detect 
automatically which driver is available.

* JavaDB (a.k.a. Derby)
* PostgreSQL (requires manual installation of the EPSG database however).

I would guess that one of JavaDB or HSQL JDBC driver is available in the JBoss 
environment. I would suggest to put the same driver in your Eclipse environment.

If you wonder where is the EPSG database, it should have been created in the 
following directory:

<user home directory>/.geotoolkit.org/EPSG

Replace ".geotoolkit.org" by "Application Data/Geotoolkit.org" if you are on 
Windows, or "Library/Geotoolkit.org" if you are on MacOS X. The location of that 
directory is configurable if you wish to move it.



More information about the Geotoolkit mailing list