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?

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




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

Reply via email to