Hi all,

I'm struggling with the GT resampling operation. My code (to quarter  
the pixels) is working so far, i.e. I get a new GridCoverage with  
four times the number of pixels. The pixel values are correct except  
for the top-most row and the left column, thus from:

1 2 3
4 5 6
7 8 9

I get:

0 0 0 0 0 0
0 1 2 2 3 3
0 4 5 5 6 6
0 4 5 5 6 6
0 7 8 8 9 9
0 7 8 8 9 9

Here is my code:

GridCoverage2D gc = ...
gc.show("Original");
GeneralGridRange newRange = new GeneralGridRange(new int[] {0, 0},  
new int[] {15*2, 10*2});
Envelope env = gc.getEnvelope();
GridGeometry2D gridGeo = new GridGeometry2D(newRange, env);
DefaultProcessor processor = new DefaultProcessor(null);
ParameterValueGroup resampleParams = processor.getOperation 
("Resample").getParameters();
resampleParams.parameter("Source").setValue(gc);   
resampleParams.parameter("CoordinateReferenceSystem").setValue 
(gc.getCoordinateReferenceSystem());
resampleParams.parameter("GridGeometry").setValue(gridGeo);
GridCoverage2D newGc = (GridCoverage2D) processor.doOperation 
(resampleParams);
newGc.show("Resampled");

I don't have a clue about the problem. Do you?

Christian

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to