Ciao Linda,

if you want to change the resolution of a gridcoverage you need to
impose it using the resample operation..

On geotools trunk, I have put together this snippet:

        final double scaleX =  500;
        final double scaleY = 1000;
        final AffineTransform at =
AffineTransform.getScaleInstance(scaleX, scaleY);
        final MathTransform   tr = ProjectiveTransform.create(at);

        final GeneralGridGeometry geometry = new
GeneralGridGeometry(PixelInCell.CELL_CENTER, tr, envelope);
        final GridCoverage2D newGrid = (GridCoverage2D)
Operations.DEFAULT.resample(grid,grid.getCoordinateReferenceSystem(),
geometry, null);


this should conserve the original envelope and CRS but should resample
the coverage. Noticed that I assumed that your CRS is projected and
the UoM is meters. I have not tested this code, so please let me know
how it goes.

Simone.
-------------------------------------------------------
Ing. Simone Giannecchini
GeoSolutions S.A.S.
Founder - Software Engineer
Via Carignoni 51
55041  Camaiore (LU)
Italy

phone: +39 0584983027
fax:      +39 0584983027
mob:    +39 333 8128928


http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.linkedin.com/in/simonegiannecchini
http://twitter.com/simogeo

-------------------------------------------------------



On Thu, May 6, 2010 at 12:00 PM, Adnila <[email protected]> wrote:
>
> hey,
> yes I saw this operation. But I do not really get how to manipulate the
> parameters to change resolution. It is always a little bit difficult to put
> everything  together without some code snippets. Is there any example of
> changing resolution? I have to use real world units for the resolution for
> example 1000 m.
> --
> View this message in context: 
> http://osgeo-org.1803224.n2.nabble.com/Rescale-GridCoverage2D-with-fixed-resolution-tp5008772p5013428.html
> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>

------------------------------------------------------------------------------
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to