Search in sources :

Example 1 with ResampleBorderComportement

use of org.geotoolkit.image.interpolation.ResampleBorderComportement in project geotoolkit by Geomatys.

the class ResampleProcess method execute.

/**
 * Resamples a grid coverage.
 */
@Override
protected void execute() throws ProcessException {
    final GridCoverage source = inputParameters.getValue(IN_COVERAGE);
    final double[] background = inputParameters.getValue(IN_BACKGROUND);
    InterpolationCase interpolation = inputParameters.getValue(IN_INTERPOLATION_TYPE);
    final ResampleBorderComportement border = inputParameters.getValue(IN_BORDER_COMPORTEMENT_TYPE);
    CoordinateReferenceSystem targetCRS = (CoordinateReferenceSystem) inputParameters.parameter("CoordinateReferenceSystem").getValue();
    final GridGeometry targetGG = inputParameters.getValue(IN_GRID_GEOMETRY);
    final GridCoverage target;
    try {
        target = reproject(source, targetCRS, targetGG, interpolation, border, background);
    } catch (FactoryException exception) {
        throw new CannotReprojectException(Errors.format(Errors.Keys.CantReprojectCoverage_1, CoverageUtilities.getName(source)), exception);
    } catch (TransformException exception) {
        throw new CannotReprojectException(Errors.format(Errors.Keys.CantReprojectCoverage_1, CoverageUtilities.getName(source)), exception);
    }
    outputParameters.getOrCreate(OUT_COVERAGE).setValue(target);
}
Also used : GridGeometry(org.apache.sis.coverage.grid.GridGeometry) GridCoverage(org.apache.sis.coverage.grid.GridCoverage) FactoryException(org.opengis.util.FactoryException) TransformException(org.opengis.referencing.operation.TransformException) InterpolationCase(org.geotoolkit.image.interpolation.InterpolationCase) CoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem) ResampleBorderComportement(org.geotoolkit.image.interpolation.ResampleBorderComportement)

Aggregations

GridCoverage (org.apache.sis.coverage.grid.GridCoverage)1 GridGeometry (org.apache.sis.coverage.grid.GridGeometry)1 InterpolationCase (org.geotoolkit.image.interpolation.InterpolationCase)1 ResampleBorderComportement (org.geotoolkit.image.interpolation.ResampleBorderComportement)1 CoordinateReferenceSystem (org.opengis.referencing.crs.CoordinateReferenceSystem)1 TransformException (org.opengis.referencing.operation.TransformException)1 FactoryException (org.opengis.util.FactoryException)1