Anaxa Gore a écrit :
> I am using this code this code for reprojecting :
>
> GeoTiffReader reader = new GeoTiffReader(geotiffFiles[i], new
> Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE));
> GridCoverage2D temp = (GridCoverage2D)reader.read(null);
>
> try{
> temp = (GridCoverage2D) Operations.DEFAULT.resample(
> temp,
> CRS.decode("EPSG:23891"));
> }catch(NoSuchAuthorityCodeException nsace){nsace.printStackTrace();
> }catch(FactoryException fe){fe.printStackTrace();}
As a matter of style I strongly recommand to banish anything like:
try {
...
} catch (SomeException e) {
e.printStackTrace();
// Continue as if everything was going well...
}
This is asking for trouble. Either do a real handling of this exception, or let
it propagates. In this case letting the exception propagates is probably
appropriate.
> And I can't understand anything ! This code didnt work yesterday and now
> it is working...! (it doesnt generate any exception...working is another
> thing). I just update and re compile from the svn...
>
> Infortunately, when I display the map, it doesnt seems to be
> reprojected. And the resolution is very bad considering the initial one
> ! Is it the good way to reproject a raster ?
We can guess with this information. What do you means by "the resolution is
very
bad"? What is your source CRS? Which MathTransform do you get?
> To speak about modifying the GridCoverage2D...If I understand well , I
> have to extract the WritableRenderedImage using the getRenderedImage
> method, then I use the setData and put the new WritableRenderedImage in
> a new GridCoverage2D... Is that true Martin ?
This is one approach. But you don't need to put the new WritableRenderedImage
in
a new Coverage2D - pixel values are changed in-place. And rather than using
setData, you may consider using javax.media.jai.iterator package if you only
want to change a few pixels (setData will be more efficient if you want to
change a large area).
Martin
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Register now and save $200. Hurry, offer ends at 11:59 p.m.,
Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users