Hey Martin.

I looked around in the GridCoverageRenderer and found
out that it does not use the provided MathTransform,
but makes one based on the envelope, so the
MathTransform is not taken into account. 
I fixed it up so that if there is a MathTransform this
is used and now it seems to work. I also added some
scaling of the envelope in case of a rotation since
rotating an envelope increases its size. 
The code works for what I need it for, but it should 
be tested against different cases than mine before its
ready to include in geotools.. and it should be
polished up a bit, there are some static methods that
should probably be put somewhere else, but I don't
know where.. 

I have attached the source code for the edited
GridCoverageRenderer..

- Kasper Kaergaard


--- Martin Desruisseaux
<[EMAIL PROTECTED]> wrote:

> Kaergaard Kasper a écrit :
> > I'm trying to show radar picture together with a
> > background image and some catchments on a map. The
> > radar picture is rotated 11 degrees compared to
> the
> > normal north and therefor the north of the
> background
> > image.. 
> > 
> > So far I have not been able to show two
> GridCoverages
> > with different angles on a map. 
> > I have tried to supply a MathTransform to my
> > gridCoverage, this has no effect and I can see
> that in
> > the DefaultMapContext the information is lost, ie.
> on
> > information about the Envelope is considered.
> Therefor
> > I have tried to set up different CRS for the two
> > GridCoverages here is my code:
> 
> Its look like a bug. The math transform should be
> taken in account.
> 
> The legacy J2D-Renderer was taking the math
> transform in account. It is possible 
> that the renderer used by JMapPane (I'm not sure
> which one exactly) ignores the 
> math transform and consider only the envelope.
> 
> If the above hypothesis is right (but I'm really not
> sure, since I don't know 
> the details of JMapPane and streaming renderer),
> then some possible actions are:
> 
>    * Use J2D-Renderer instead, but it would force
> you to go back to a previous
>      Geotools implementation and will involve more
> pain when migrating back to
>      a more recent Geotools version. Probably not a
> recommanded approach.
> 
>    * Get the JMapPane / Streaming renderer to use
> the MathTransform instead of
>      the Envelope (again, I'm not sure that the
> problem is there - just an
>      hypothesis. But I know that managing correctly
> CRS information in a
>      renderer is a non-trivial task. The CRS
> handling was more rigourous in
>      J2D-Renderer because this renderer was wrote by
> the same author than
>      the CRS framework).
> 
>    * Wait for GO-1 implementation (the replacement
> of J2D-Renderer) to be ready,
>      but it may really take a while...
> 
>    * Rotate the GridCoverage yourself before to pass
> it to the renderer. Once
>      you have created a GridCoverage with the
> correct MathTransform (you may
>      also try a DerivedCRS), try the following:
> 
>          gc = Operations.resample(gc,
> yourDisplayCRS);
> 
>      It may also be worth to try the most extensive
> "resample" flavor with
>      more arguments (including a GridGeometry). The
> Operations class is in
>      org.geotools.coverage.processing if my memory
> serve me right.
> 
> Martin
> 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Attachment: WAGridCoverageRenderer.java
Description: 574529459-WAGridCoverageRenderer.java

-------------------------------------------------------------------------
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