Bernd Resch a écrit :
1.) I've implemented a coordinate transformation service using GeoTools
2.1 shown in the following code. It converts different CRSs to WGS84_3.
Now, if I want to transform a point from "Gauß-Krüger 31", which is an
Austrian CRS (EPSG:31295) using the Bessel 1841 ellipsoid, several
Bursa-Wolf parameters have to be added. How can this be done using
GeoTools 2.1?
The example provided by John Grange should work well. The Bursa-Wolf
parameters appears in the "TOWGS84[...]" part of the WKT.
Otherwise an other approach is to do the following: using Geotools
2.2.M2 or above, make sure that the following JARs are in yours classpath:
- gt2-referencing
- Only one of gt2-epsg-access, gt2-epsg-hsql or gt2-epsg-postgresql
All other gt2 jars can be safely ignored if you only want the coordinate
transformation services.
If you choose gt2-epsg-access, then you need to download the EPSG
database in MS-Access format from http://www.epsg.org and register it as
an ODBC source (in the Window control panel) named "EPSG". If you choose
gt2-epsg-hsql, then you have nothing to download or install (since the
EPSG database is bundled straight into gt2-epsg-hsql), but you need the
HSQL engine (hsqldb.jar if my memory serve me right) in yours classpath.
Then, you can get yours CRS with the following code:
CRSAuthorityFactory factory;
CoordinateReferenceSystem sourceCRS, targetCRS;
factory = FactoryFinder.getCRSAuthorityFactory("EPSG", null);
sourceCRS = factory.createCoordinateReferenceSystem("EPSG:31295");
targetCRS = factory.createCoordinateReferenceSystem("EPSG:4326");
// Now transform like usual...
The EPSG database contains Bursa-Wolf parameters, so there is nothing to
do on the user side. Actually, it sometime contains more detailled
informations than what WKT can express.
2.) I also tried to tackle this problem with GeoTools 2.2 M2 by using
the class "GeocentricTranslation". I also posted my (perhaps completely
wrong) code below.
GeocentricTranslation is just one step in the transformation chain
between two CRS; GeocentricTranslation alone is not enough (to be more
specific, geographic coordinates must be converted into geocentric
coordinates first, and the result converted back to geographic
coordinates). It is probably better to use one of the approachs cited
above instead, and let Geotools build the transformation chain.
Martin.
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users