Thanks a lot Martin, GeoTools is not bugged, it's about my use...
But even if add the "true" argument in CRS.decode() I have the same values! :( In fact WKTs are exactly the same: EPSG:4326 are still in grade units (EPSG:4326 was already in degree units before adding the extra argument). Should I upgrade to Geotools 2.4-SNAPSHOT? -----Message d'origine----- De : Martin Desruisseaux [mailto:[EMAIL PROTECTED] Envoyé : mercredi 18 avril 2007 18:22 À : zze-M2S FRISON V ext RD-BIZZ-SOP Cc : [email protected]; Vincent Frison Objet : Re: [Geotools-gt2-users] WGS84 to Lambert2e transforming zze-M2S FRISON V ext RD-BIZZ-SOP a écrit : > INFO [main] (_TestFeatureTransforming.java:28_): Original WGS84 > coordinates: (7.0, 43.0, NaN) INFO [main] > (_TestFeatureTransforming.java:33_): (999870.608360379, > 1789915.8576742434, NaN) <-- GeoTools transform INFO [main] > (_TestFeatureTransforming.java:37_): > (980808.5279030021,1788755.1365062557, NaN) <-- SIGForum.org transform Just tried with Geotools 2.4-SNAPSHOT and got: 980808.527, 1788755.14 <-- GeoTools transform Which is one centimeter close to sigforum.org calculation. > CoordinateReferenceSystem crsWGS84 = CRS.decode("EPSG:4326"); > CoordinateReferenceSystem crsLambert2e = CRS.decode("EPSG:27572"); Try CRS.decode("EPSG:4326", true). Same for EPSG:27572. > Coordinate c1 = *new* Coordinate(7.0, 43.0); If you only want to transform 2D points, it would be better to use org.geotools.geometry.DirectPosition2D (or org.geotools.geometry.GeneralDirectPosition for n-D). > BTW I have this interesting error message at the begining of the output: > > 18 avr. 2007 14:38:27 FactoryRegistry scanForPlugins > > ATTENTION: Échec lors de l'initialisation d'un service de catégorie > "MathTransformProvider". La cause est "NoClassDefFoundError: > javax/media/jai/WarpAffine". > > Could it explain the imprecision? No. It is more likely that something was wrong with the CRS you built. As a general rule in case of doubt, alway use System.out.println(crsLambert2e) and read very carefully what you get (every lines). From your previous email: AXIS["Lon", EAST], AXIS["Lat", NORTH], which is okay, and: UNIT["grade", 0.015707963267948967], So this CRS expect (longitude,latitude) in grade units, not degrees. This is not a mistake; EPSG really defines the "27572" CRS that way and by default Geotools tries to do exactly what EPSG said. The "true" argument in CRS.decode(...) above forces the axis order to (longitude,latitude) even if the EPSG database said the opposite. But in addition, it also forces angular units to "degrees" even if the EPSG database said something else. Martin ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
