private GridCoverage2D retainBands( List<Integer> bandIndices, GridCoverage2D coverage, Hints hints) { final ParameterValueGroup param = PROCESSOR.getOperation("SelectSampleDimension").getParameters(); param.parameter("Source").setValue(coverage); final int[] sampleDimensionArray = ArrayUtils.toPrimitive(bandIndices.toArray(new Integer[bandIndices.size()])); param.parameter("SampleDimensions").setValue(sampleDimensionArray); coverage = (GridCoverage2D) PROCESSOR.doOperation(param, hints); return coverage; }
param.parameter("geometry").setValue(target); return (GridCoverage2D) PROCESSOR.doOperation(param);
result = (GridCoverage2D) PROCESSOR.doOperation(param, localHints); } else {
/** * Crops the coverage to the specified bounds * * @param coverage * @param bounds */ public static GridCoverage2D crop(final GridCoverage2D coverage, final Envelope bounds) { // checks final ReferencedEnvelope cropBounds = new ReferencedEnvelope(bounds); final ReferencedEnvelope coverageBounds = new ReferencedEnvelope(coverage.getEnvelope()); if (cropBounds.contains((org.locationtech.jts.geom.Envelope) coverageBounds)) { return coverage; } Polygon polygon = JTS.toGeometry(cropBounds); Geometry roi = polygon.getFactory().createMultiPolygon(new Polygon[] {polygon}); // perform the crops final ParameterValueGroup param = PROCESSOR.getOperation("CoverageCrop").getParameters(); param.parameter("Source").setValue(coverage); param.parameter("Envelope").setValue(bounds); param.parameter("ROI").setValue(roi); return (GridCoverage2D) PROCESSOR.doOperation(param); }
/** * Applies a process operation to a coverage. The default implementation checks if source * coverages use an interpolation, and then invokes {@link AbstractOperation#doOperation}. If * all source coverages used the same interpolation, then this interpolation is applied to the * resulting coverage (except if the resulting coverage has already an interpolation). * * @param parameters Parameters required for the operation. The easiest way to construct them is * to invoke <code>operation.{@link Operation#getParameters getParameters}()</code> and to * modify the returned group. * @return The result as a coverage. * @throws OperationNotFoundException if there is no operation for the parameter group name. */ public Coverage doOperation(final ParameterValueGroup parameters) throws OperationNotFoundException { return doOperation(parameters, null); }
/** * Applies a process operation with default parameters. This is a helper method for * implementation of various convenience methods in this class. * * @param operationName Name of the operation to be applied to the coverage. * @param source The source coverage. * @return The result as a coverage. * @throws OperationNotFoundException if there is no operation named {@code operationName}. * @throws CoverageProcessingException if the operation can't be applied. */ protected final Coverage doOperation(final String operationName, final Coverage source) throws OperationNotFoundException, CoverageProcessingException { final Operation operation = processor.getOperation(operationName); final ParameterValueGroup parameters = operation.getParameters(); addSources(operationName, parameters, source); return processor.doOperation(parameters); }
/** * Applies a process binary operation on two coverages with default parameters. This is a helper * method for implementation of various convenience methods in this class. * * @param operationName Name of the operation to be applied to the coverage. * @param source0 The first source coverage. * @param source1 The second source coverage. * @return The result as a coverage. * @throws OperationNotFoundException if there is no operation named {@code operationName}. * @throws CoverageProcessingException if the operation can't be applied. */ protected final Coverage doOperation( final String operationName, final Coverage source0, final Coverage source1) throws OperationNotFoundException, CoverageProcessingException { final Operation operation = processor.getOperation(operationName); final ParameterValueGroup parameters = operation.getParameters(); addSources(operationName, parameters, source0, source1); return processor.doOperation(parameters); }
param.parameter("Source").setValue(coverage); GridCoverage2D extrema = (GridCoverage2D) PROCESSOR.doOperation(param); Object max = extrema.getProperty("maximum"); param.parameter("constants").setValue(max); return (GridCoverage2D) PROCESSOR.doOperation(param);
@DescribeResult(name = "result", description = "Summed rasters") public GridCoverage2D execute( @DescribeParameter(name = "coverageA", description = "First input raster") GridCoverage2D coverageA, @DescribeParameter(name = "coverageB", description = "Second input raster") GridCoverage2D coverageB, ProgressListener progressListener) throws ProcessException { // // // // Initialization: compatibility checks // // // BaseCoverageAlgebraProcess.checkCompatibleCoverages(coverageA, coverageB); // // // // Doing the Operation // // // final ParameterValueGroup param = PROCESSOR.getOperation("Add").getParameters(); List<GridCoverage2D> sources = new ArrayList<GridCoverage2D>(); sources.add(coverageA); sources.add(coverageB); param.parameter("Sources").setValue(sources); return (GridCoverage2D) PROCESSOR.doOperation(param); } }
@DescribeResult(name = "result", description = "Computed raster") public GridCoverage2D execute( @DescribeParameter(name = "coverageA", description = "First input raster") GridCoverage2D coverageA, @DescribeParameter(name = "coverageB", description = "Second input raster") GridCoverage2D coverageB, ProgressListener progressListener) throws ProcessException { // // // // Initialization: compatibility checks // // // BaseCoverageAlgebraProcess.checkCompatibleCoverages(coverageA, coverageB); // // // // Doing the Operation // // // final ParameterValueGroup param = PROCESSOR.getOperation("Multiply").getParameters(); List<GridCoverage2D> sources = new ArrayList<GridCoverage2D>(); sources.add(coverageA); sources.add(coverageB); param.parameter("Sources").setValue(sources); return (GridCoverage2D) PROCESSOR.doOperation(param); } }
/** * Applies a process operation with one parameter. This is a helper method for implementation of * various convenience methods in this class. * * @param operationName Name of the operation to be applied to the coverage. * @param source The source coverage. * @param argumentName1 The name of the first parameter to setParameterValue. * @param argumentValue1 The value for the first parameter. * @return The result as a coverage. * @throws OperationNotFoundException if there is no operation named {@code operationName}. * @throws InvalidParameterNameException if there is no parameter with the specified name. * @throws CoverageProcessingException if the operation can't be applied. */ protected final Coverage doOperation( final String operationName, final Coverage source, final String argumentName1, final Object argumentValue1) throws OperationNotFoundException, InvalidParameterNameException, CoverageProcessingException { final Operation operation = processor.getOperation(operationName); final ParameterValueGroup parameters = operation.getParameters(); addSources(operationName, parameters, source); setParameterValue(parameters, argumentName1, argumentValue1); return processor.doOperation(parameters); }
private GridCoverage2D cropCoverage(GridCoverage2D coverage, ReferencedEnvelope cropEnvelope) { if (isNotEmpty(cropEnvelope)) { final ParameterValueGroup param = PROCESSOR.getOperation("CoverageCrop").getParameters(); param.parameter("Source").setValue(coverage); param.parameter("Envelope").setValue(cropEnvelope); try { GridCoverage2D cropped = (GridCoverage2D) PROCESSOR.doOperation(param); return cropped; } catch (EmptyIntersectionException e) { return null; } } else { return null; } }
return (GridCoverage2D) PROCESSOR.doOperation(param);
param.parameter("ROI").setValue(roi); return (GridCoverage2D) PROCESSOR.doOperation(param);
param.parameter("Source").setValue(dataCoverage); param.parameter("Envelope").setValue(new GeneralEnvelope(geometryEnvelope)); cropped = (GridCoverage2D) PROCESSOR.doOperation(param);
return (GridCoverage2D) PROCESSOR.doOperation(param);
return (GridCoverage2D) PROCESSOR.doOperation(param);
return (GridCoverage2D) PROCESSOR.doOperation(param);
return (GridCoverage2D) PROCESSOR.doOperation(params);
return (GridCoverage2D) PROCESSOR.doOperation(param);