Hi mailing list members!
First of all, I'm a newbie in GeoTools and this is my first post, so
patience please... =^D
Well, I'm using the RendererUtilities.worldToScreenTransform() method to get
real coordinate from a GridCoverage2D, and then mapping this point on
image's coordinate into other GridCoverage2D by a second transform. This
coverages are not aligned. So, the same region would be matched on that two
images, but in differents coordinates, of course. However, plotting each
calculated point into corresponding images, different regions are
referenced...
The coverages have the same CRS. Actually, those images are obtained from
LANDSAT5, band 4, on different epochs (2000 and 2008), so I'm think that
they must have the same CRS, haven't? Furthermore, I has checked this
through the GridCoverage2D's toWKT() method.
Here is a snipe code from what I did:
//Get the coverages...
GridCoverage2D gc0 = ...;
GridCoverage2D gc1 = ...;
//Calculate a screenToWorld and a worldToScreen transforms to map a
//point from a coverage to other else
AffineTransform t0 = RendererUtilities.worldToScreenTransform(
new ReferencedEnvelope(
gc0.getEnvelop2D(),
gc0.getCoordinateReferenceSystem()
),
gc0.getRenderedImage().getBounds()
).createInverse();
AffineTransform t1 = RendererUtilities.worldToScreenTransform(
new ReferencedEnvelope(
gc1.getEnvelop2D(),
gc1.getCoordinateReferenceSystem()
),
gc1.getRenderedImage().getBounds()
);
//Maps the first coverage's center into the second coverage.
Point2D.Double p0 = new Point2D.Double( //First coverage's
center...
gc0.getWidth() / 2.d, gc0.getHeight() / 2.d
);
Point2D.Double p1 = (Point2D.Double)
t1.transform(
t0.transform(
p0, null
), null
);
I already search on list but don't find a direct solution...
PS: I'm using GeoTools 2.3.5 cause old code needs, and I not be able to
change this...
Thanks for any help!
José
--
View this message in context:
http://n2.nabble.com/Problem-with-worldToScreenTransform-tp1321649p1321649.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users