Gabriella Turek a écrit :
> The wording in the documentation is ambiguous: it just says the "grid
> has been rotated". My guess is that the grid coverage relative to
> the CRS has been rotated but I'd be interested in how to handle both cases.
> Thanx!
> gaby
> 
> Martin Desruisseaux wrote:
>> What is rotated exactly? The Coordinate Reference System (CRS)
>> "northing" relative to longitude lines, or the grid coverage relative to
>> the CRS? The rotation is handled differently in the two cases.


If a CRS is rotated relative to some other CRS, we can do the following:

AffineTransform rotation = AffineTransform.getRotateInstance(...);
// Note: In the above construction, you will probable need to consider
//       the translation terms too if the rotation is performed around
//       any other point than (0,0).

MathTransform transform = ProjectiveTransform.create(rotation);
OperationMethod method = new DefaultOperationMethod(transform);
CoordinateReferenceSystem originalCRS = ...
CoordinateReferenceSystem rotatedCRS = new DefaultDerivedCRS("some name", 
method, originalCRS, transform, originalCRS.getCoordinateSystem());



If the grid is rotated relative to the CRS, create an AffineTransform that 
represents the transformation from grid to CRS taking in account this rotation:

double scaleX = ...;
double scaleY = ...;
double translateX = ...;
double translateY = ...;
AffineTransform at = new AffineTransform(scaleX, 0, 0, scaleY, translateX, 
translateY);
at.rotate(...);
MathTransform gridToCRS = ProjectiveTransform.create(at);

and now use the GridGeometryFactory.create(...) method that expect a 
MathTransform argument instead of an Envelope.

     Martin

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to