Well you have a small clue, that "lenient" is used when the two coordinate
systems use a different model for the shape of the earth, so no correct
transformation exists between the two systems. Indeed we can see that, in
the definition.
So you are not doing anything wrong, question is what do you want to do?
You are going to have to make an assumption on how to do the DATM shift,
but what assumption do you want to make? Sounds like you would like to
make the same assumption as PROJ....
Check what PROJ is doing and copy their "+towgs84" parameters when
constructing your WKT by hand.
Jody
Jody Garnett
On Tue, Nov 19, 2013 at 5:41 AM, Christian Gendreau <
christiangendr...@gmail.com> wrote:
> Hi,
>
> I'm trying to convert/transform some coordinates from one CRS to
> another using JTS.transform(...)
> There is a difference in what GeoTools 10 returns and what PostGIS and
> QGIS return.
> I'm aware that the parameters used by GeoTools are from the EPSG
> database and are not managed by GeoTools but I'm having an issue when
> I provide the exact WTK.
>
> Input is in EPSG:27572 (Lambert zone II)
> -------
> CoordinateReferenceSystem sourceCrs = CRS.decode("EPSG:27572");
> CoordinateReferenceSystem targetCrs = DefaultGeographicCRS.WGS84;
>
> Coordinate coord = new Coordinate(605937.033, 2426318.714);
> Point sourcePoint = geometryFactory.createPoint(coord);
> MathTransform transform = CRS.findMathTransform(sourceCrs, targetCrs);
> Geometry targetGeometry = JTS.transform( sourcePoint, transform);
> -------
>
> This will not work except if I use the 'lenient' flag and then I will get:
> POINT (2.4180555600606395 48.832161511178725)
> This is 400 meters offset but there is no TOWGS84 parameters provided
> so I'm don't know what accuracy to expect.
>
> So I tried with PostGIS 2.0.1 and I got : POINT(2.41733554398175
> 48.8352090484985)
> This is correct.
>
> Then, I tried to use the PostGIS WTK definition in GeoTools.
>
> crs = CRS.parseWKT("PROJCS[\"NTF (Paris) / Lambert zone
> II\",GEOGCS[\"NTF
>
> (Paris)\",DATUM[\"Nouvelle_Triangulation_Francaise_Paris\",SPHEROID[\"Clarke
> 1880
> (IGN)\",6378249.2,293.4660212936265,AUTHORITY[\"EPSG\",\"7011\"]],TOWGS84[-168,-60,320,0,0,0,0],AUTHORITY[\"EPSG\",\"6807\"]],PRIMEM[\"Paris\",2.33722917,AUTHORITY[\"EPSG\",\"8903\"]],UNIT[\"grad\",0.01570796326794897,AUTHORITY[\"EPSG\",\"9105\"]],AUTHORITY[\"EPSG\",\"4807\"]],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],PROJECTION[\"Lambert_Conformal_Conic_1SP\"],PARAMETER[\"latitude_of_origin\",52],PARAMETER[\"central_meridian\",0],PARAMETER[\"scale_factor\",0.99987742],PARAMETER[\"false_easting\",600000],PARAMETER[\"false_northing\",2200000],AUTHORITY[\"EPSG\",\"27572\"],AXIS[\"X\",EAST],AXIS[\"Y\",NORTH]]");
>
> and I got: POINT (2.183603198566145 48.8352075151015)
> which is 17 km offset.
>
> Does anyone know what I'm doing wrong?
>
> Thanks,
>
> Christian Gendreau
>
>
> ------------------------------------------------------------------------------
> Shape the Mobile Experience: Free Subscription
> Software experts and developers: Be at the forefront of tech innovation.
> Intel(R) Software Adrenaline delivers strategic insight and game-changing
> conversations that shape the rapidly evolving mobile landscape. Sign up
> now.
> http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing
conversations that shape the rapidly evolving mobile landscape. Sign up now.
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users