Ciao Adnila,
please read below....
-------------------------------------------------------
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 Fri, May 21, 2010 at 4:53 PM, Adnila <[email protected]> wrote:
>
> hey guys,
> I still have some problems, can you help?
>
>> GridEnvelope2D newGEnv = new GridEnvelope2D(0, 0, xDim, yDim);
> why is it zero? and not curGridEnv.x/curGridEnv.y?
>
> I have the following code snippet now:
>
> // initialize new processor and parameters
>                crs = new CoordReferSyst();
>                DefaultProcessor processor = new DefaultProcessor(null);
>                ParameterValueGroup parameters =
>                       processor.getOperation("Resample").getParameters();
>                parameters.parameter("Source").setValue(gc2D);
>
>                // interpolation can be NearestNeighbor, Bilinear or Bicubic
>                
> parameters.parameter("InterpolationType").setValue("NearestNeighbor");
>
>                // get current grid geometry, envelope and range
>                GridGeometry2D curGridGeom = gc2D.getGridGeometry();
>                Envelope2D curWorldEnv = curGridGeom.getEnvelope2D();
>                GridEnvelope2D curGridEnv = curGridGeom.getGridRange2D();
>
>                // cell size to fixed value
>                double cellSize = gridCellWidth;
>
>                int xDim = (int) (curWorldEnv.getWidth()/cellSize);
>                int yDim = (int) (curWorldEnv.getHeight()/cellSize);
>
>                GridEnvelope2D newGEnv = new GridEnvelope2D(curGridEnv.x, 
> curGridEnv.y,
> xDim, yDim);
>                GridGeometry2D newGG = new GridGeometry2D(newGEnv, 
> (Envelope)curWorldEnv);
>                parameters.parameter("GridGeometry").setValue(newGG);
>
> //parameters.parameter("CoordinateReferenceSystem").setValue(crs.crs_ETRS89_LAEA());
>
>                GridCoverage2D resampledCov = (GridCoverage2D)
> processor.doOperation(parameters);
>                return resampledCov;
>
> If the new cell width is larger than the old one everything is fine. but if
> it is smaller, the values are not correct, I guess. If I change to cell
> width from larger to finer, the values are not allowed to change. am I
> right? for example at first I have 1000m cell width with one cell with value
> 3 and new cell width is 100m, than I have also the value 3 everywhere just
> splitted into 10 pieces. right?

Honestly I did not get what you are trying to say, can you clarify?

>
> I have problems with the coordinate reference system. I think the code is
> correct. isn't it?
>

I would not mix up reprojection with resampling. I would do what follows:

- if you are upsampling, first reproject than upsample
- if you are downsampling, first downsample then reproject.


Simone.


>
>
>
> --
> View this message in context: 
> http://osgeo-org.1803224.n2.nabble.com/Rescale-GridCoverage2D-with-fixed-resolution-tp5008772p5084621.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