you can add a TOWGS84 as per the example below - hope this helps private static final String OSGBWKT="PROJCS[\"OSGB 1936 / British National Grid\", \n" + " GEOGCS[\"OSGB 1936\", \n" + " DATUM[\"OSGB_1936\", \n" + " SPHEROID[\"Airy 1830\", 6377563.396, 299.3249646], \n" + " TOWGS84[375,-111,431,0,0,0,0]], \n" + " PRIMEM[\"Greenwich\", 0.0], \n" + " UNIT[\"degree\", 0.017453292519943295], \n" + " AXIS[\"Lon\", EAST], \n" + " AXIS[\"Lat\", NORTH]], \n" + " PROJECTION[\"Transverse_Mercator\", AUTHORITY[\"OGC\",\"Transverse_Mercator\"]], \n" + " PARAMETER[\"central_meridian\", -2.0], \n" + " PARAMETER[\"latitude_of_origin\", 49.0], \n" + " PARAMETER[\"scale_factor\", 0.9996012717], \n" + " PARAMETER[\"false_easting\", 400000.0], \n" + " PARAMETER[\"false_northing\", -100000.0], \n" + " UNIT[\"m\", 1.0], \n" + " AXIS[\"x\", EAST], \n" + " AXIS[\"y\", NORTH] \n" + " ]";
John Grange Senior Software Engineer Tel: +44 (0)1749 834922 email: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> BlueFinger Limited Underwood Business Park Wookey Hole Road, WELLS. BA5 1AF Tel: +44 (0)1749 834900 Fax: +44 (0)1749 834901 web: www.bluefinger.com Company Reg No: 4209395 Underwood Business Park, Wookey Hole Road, Wells, Somerset BA5 1AF. *** This E-mail contains confidential information for the addressee only. If you are not the intended recipient, please notify us immediately. You should not use, disclose, distribute or copy this communication if received in error. No binding contract will result from this e-mail until such time as a written document is signed on behalf of the company. BlueFinger Limited cannot accept responsibility for the completeness or accuracy of this message as it has been transmitted over public networks.*** -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Bernd Resch Sent: Tuesday, December 13, 2005 12:31 PM To: geotools-gt2-users@lists.sourceforge.net Subject: [Geotools-gt2-users] coordinate transformation with additional Bursa-Wolf parameters. Hello, 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? 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. Can I anyhow just incorporate the Bursa-Wolf parameters into my ordinary transformation service (s. ad 1.))? Or can't that be achieved by creating a CRS from a WKT? ad 1.) public static DirectPosition transformCoords(double x_co, double y_co, String sCRS) { CoordinateReferenceSystem sourceCRS = null; CoordinateReferenceSystem targetCRS = null; MathTransform math = null; DirectPosition2D aPosition = new DirectPosition2D(x_co, y_co); DirectPosition transformedDP = null; try { CRSFactory crsFactory = FactoryFinder.getCRSFactory(null); String sourceWKT = CRSFromWKTCreator.generateWKT(sCRS); String targetWKT = "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]"; sourceCRS = crsFactory.createFromWKT(sourceWKT); targetCRS = crsFactory.createFromWKT(targetWKT); DirectPosition2D transformedPos = new DirectPosition2D(); math = CRS.transform(sourceCRS, targetCRS, true); transformedDP = math.transform(aPosition, null); }catch(NoSuchAuthorityCodeException nsace){nsace.printStackTrace();} catch(FactoryException fe){fe.printStackTrace();}catch(TransformException te){te.printStackTrace();} return transformedDP; }// transformCoords ad 2.) public static DirectPosition transformCoords(double x_co, double y_co, String sCRS) { CoordinateReferenceSystem sourceCRS = null; MathTransform math = null; DirectPosition2D aPosition = new DirectPosition2D(x_co, y_co); DirectPosition transformedDP = null; try { CRSFactory crsFactory = FactoryFinder.getCRSFactory(null); String sourceWKT = CRSFromWKTCreator.generateWKT(sCRS); String targetWKT = "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]"; sourceCRS = crsFactory.createFromWKT(sourceWKT); DefaultGeographicCRS geoCRS = org.geotools.referencing.crs.DefaultGeographicCRS.WGS84; DefaultCartesianCS cartCS = org.geotools.referencing.cs.DefaultCartesianCS.PROJECTED; final CoordinateReferenceSystem targetCRS = crsFactory.createFromWKT(targetWKT); final BursaWolfParameters toWGS84 = new BursaWolfParameters(DefaultGeodeticDatum.WGS84); toWGS84.dx = 577.326; toWGS84.dy = 90.129; toWGS84.dz = 463.919; toWGS84.ex = 5-137; toWGS84.ey = 1.474; toWGS84.ez = 5.297; toWGS84.ppm = 2.4232; GeocentricTranslation geoTrans = new GeocentricTranslation(toWGS84); GeneralDirectPosition fromPos = new GeneralDirectPosition(x_co,y_co); GeneralDirectPosition toPos = new GeneralDirectPosition(targetCRS); transformedDP = geoTrans.transform(fromPos,toPos); }catch(NoSuchAuthorityCodeException nsace){nsace.printStackTrace();} catch(FactoryException fe){fe.printStackTrace();}catch(TransformException te){te.printStackTrace();} return transformedDP; }// transformCoords Thank you very much for your help already in advance, Bernd. ------------------------------------------------------- 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=ick _______________________________________________ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users ------------------------------------------------------- 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