Hi Jan,
GeoTools will take care of the CRS for you.
For example, create a coverage with your 1000 x 1000 image and set its
world bounds to be 0 - 100m in both directions...
ReferencedEnvelope env = new ReferencedEnvelope(0, 100, 0, 100, null);
GridCoverage2D cov = gcf.create("coverage", img, env);
The coverage will automatically be given a simple AffineTransform to
convert between grid and world coords, so you can do something like
this...
// get world coords of grid cell x=200, y=100
DirectPosition dp = null;
try {
dp = cov.getGridGeometry().gridToWorld(new
GridCoordinates2D(200, 100));
} catch (TransformException ex) {
ex.printStackTrace();
}
System.out.println("world coords: " + dp);
Output is:
world coords: DirectPosition2D[20.049999237060547, 89.94999694824219]
These are the coords of the grid cell centre (with the usual fiddly
round-off error).
Note that as per the usual convention, image y increases from top to
bottom while world y is the other way.
Hope this helps,
Michael
------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users