hey, 
unfortunately it is not working.  The result looks like this: (the given
resolution was 100m)

0.0, 0.0, 0.0
100.0, 0.0, 0.0
200.0, 0.0, 0.0
300.0, 0.0, 0.0
400.0, 0.0, 0.0

before the resampling it looked like this:

4610500.0, 5675000.0, -5.2
4611500.0, 5675000.0, -5.3
4612500.0, 5675000.0, -5.3
4613500.0, 5675000.0, -5.4
4614500.0, 5675000.0, -5.4

so there is definetly something wrong. but I am not quite sure what it is.

code snippet looks like this:

// set new resolution
scaleX = resolution;
scaleY = resolution;
                
// create needed transformation
AffineTransform at = AffineTransform.getScaleInstance(scaleX, scaleY);
MathTransform tr = ProjectiveTransform.create(at);

envelope = gc2D.getEnvelope2D();
geometry = new GeneralGridGeometry(PixelInCell.CELL_CENTER, tr, envelope);
                
// set output CoordinateReferenceSystem
try {
        crs_ETRS89_LAEA = CRS.decode("EPSG:3035");
        // convert GridCoverage2D to ETRS89_LAEA
        gc2DCRSconvert = (GridCoverage2D) Operations.DEFAULT.resample(gc2D,
crs_ETRS89_LAEA, geometry, null);
        } catch (NoSuchAuthorityCodeException e) {
                // auto-generated catch block
                e.printStackTrace();
        } catch (FactoryException e) {
                 // auto-generated catch block
                e.printStackTrace();
                } 
                return gc2DCRSconvert;  

I am not quite sure about the envelope mentioned in your code. Is it like I
thought?
What now?

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