Hi all,

I have try to transform coordinate from (x,y) to (lat,long) system. I have
read some posts on this list and the wiki (Coordinate Transformation
Services for Geotools 2.0) but I haven't understand how to do it. I extract
my source CRS from a GridCoverage2D, and I would transform the bottom-left
corner coordinates in (lat, long). I have try with this code:

           //  pitGC is a GridCoverage2D
            CoordinateReferenceSystem sourceCRS =
pitGC.getCoordinateReferenceSystem();
            CoordinateReferenceSystem targetCRS =
DefaultGeographicCRS.WGS84;

            MathTransform transform = CRS.findMathTransform(sourceCRS,
targetCRS);

           //where srcPoint is the coordinate of the bottom-left coorner of
the grid
            Coordinate source =new Coordinate(srcPts[0],srcPts[1]);

            GeometryFactory gnFactory=
JTSFactoryFinder.getGeometryFactory(null);
            Point sourcePoint = gnFactory.createPoint(source);

            Geometry target = JTS.transform(sourcePint,transform);


but the target object have the same value of the sourcePoint. Maybe my
targetCRS is wrong?


thanks and regards

-- 
Daniele Andreis
------------------------------------------------------------------------------

_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to