On the side of some details, there is some simplification that could be done.

Ferdinando Villa a écrit :
> Envelope2D envelope = source.getEnvelope2D();
> Rectangle2D en = envelope.getBounds2D();
> en.setRect(en.getMinX(), en.getMinY(), en.getWidth()/2.0, en.getHeight()/2.0);
> envelope.setRect(en);

Could be simply:

   envelope.width  /= 2;
   envelope.height /= 2;


> final Resample resampleFactory = new Resample();
> final GridGeometry2D gridGeometry = new GridGeometry2D(range, envelope);
> DefaultProcessor processor = new DefaultProcessor(null);
> ParameterValueGroup resampleParams = 
> processor.getOperation("Resample").getParameters();
> resampleParams.parameter("Source").setValue(source);
> //resampleParams.parameter("CoordinateReferenceSystem").setValue(DefaultGeographicCRS.WGS84);
> resampleParams.parameter("GridGeometry").setValue(gridGeometry);
> final GridCoverage2D destination = 
> (GridCoverage2D)resampleFactory.doOperation(resampleParams, null);

You would not suggest instantiate Resample() and invoke its doOperation(...) 
method. I suggest to invoke processor.doOperation(resampleParams) instead.

But in this case, the problem is probably that if you reproject from some 
projected CRS to WGS84, the envelope is very different. It is no longuer metres 
but degrees, so just dividing the size by 2 may not be appropriate. Since I 
don't know what was the original CRS and envelope and can not tell for sure.

        Martin


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to