/** * @return this WCS interpolation type as a raster api type, or <code>null</code> if it the interpolation * method is not supported by the raster api. */ public InterpolationType asRasterAPIType() { return InterpolationType.fromString( name() ); } }
/** * Returns a subset of the raster, transformed into to SRS of the target envelope. * * @param raster * @param env * @param grid * @param interpolation * @return the transformation result * @throws TransformationException * if the transformation fails */ public static AbstractRaster transform( AbstractRaster raster, Envelope env, Grid grid, String interpolation ) throws TransformationException { LOG.debug( "Transforming raster with envelope '{}' and grid '{}', interpolation method '{}'.", new Object[] { env, grid, interpolation } ); AbstractRaster result; try { RasterTransformer transf = new RasterTransformer( env.getCoordinateSystem() ); result = transf.transform( raster, env, grid.getWidth(), grid.getHeight(), InterpolationType.fromString( interpolation ) ); } catch ( Exception e ) { LOG.debug( "Original stack trace", e ); throw new TransformationException( "error while transforming raster result: " + e.getMessage(), e ); } return result; } }
private static void checkOutputOptions( GetCoverage request, CoverageOptions options ) throws OWSException { boolean supported; String outputFormat = request.getOutputFormat(); supported = options.getOutputFormats().contains( outputFormat ); if ( !supported ) { // check for geotiff if ( outputFormat == null || !"geotiff".equals( outputFormat.toLowerCase() ) ) { throw new OWSException( "Unsupported output format (" + outputFormat + ")", OWSException.INVALID_PARAMETER_VALUE, "FORMAT" ); } } String interpolation = request.getInterpolation(); try { supported = options.getInterpolations().contains( InterpolationType.fromString( interpolation ) ); } catch ( Exception e ) { throw new OWSException( "Unsupported interpolation (" + interpolation + ")", OWSException.INVALID_PARAMETER_VALUE, "INTERPOLATION" ); } String crs = request.getOutputCRS(); supported = options.getCRSs().contains( crs ); if ( !supported ) { throw new OWSException( "unsupported response crs (" + crs + ")", OWSException.INVALID_PARAMETER_VALUE, "RESPONSE CRS" ); } }