Hello everyone.

I want to use Geotools to convert a geotiff  file to another resolution.

I find API document from geotools.org website like this:

https://docs.geotools.org/stable/javadocs/org/geotools/coverage/processing/operation/Resample.html

   - *Resampling*
   The grid coverage can be resampled at a different cell resolution. Some
   implementations may be able to do resampling efficiently at any resolution.
   Also a non-rectilinear grid coverage can be accessed as rectilinear grid
   coverage with this operation.

I can use the "resample" operation to reprojection like this:

public static GridCoverage2D resample(
            final GridCoverage2D coverage,
            final CoordinateReferenceSystem sourceCRS,
            final CoordinateReferenceSystem targetCRS,
            final GridGeometry2D gridGeometry,
            final Interpolation interpolation)
            throws WcsException {

        final ParameterValueGroup param =
                (ParameterValueGroup) PROCESSOR.getOperation("Resample").
getParameters();
        param.parameter("Source").setValue(coverage);
        param.parameter("CoordinateReferenceSystem").setValue(targetCRS);
        param.parameter("GridGeometry").setValue(gridGeometry);
        param.parameter("InterpolationType").setValue(interpolation);

        return (GridCoverage2D)
                ((Resample)
PROCESSOR.getOperation("Resample")).doOperation(param,
hints);
    }

How can I use "resample" operation to convert to another resolution?How to
set the related parameter.

Appreciate any clues.

Best regards.

Thank you very much.
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to