@Test public void testBasic() { ReferencedEnvelope envelope = new ReferencedEnvelope(-180, 180, -90, 90, DefaultGeographicCRS.WGS84); int width = 8; int height = 4; int pixelsPerCell = 1; String strategy = "Basic"; Float scaleMin = 0f; GridCoverage2D coverage = process.execute( features, pixelsPerCell, strategy, null, null, scaleMin, null, false, envelope, width, height, null); checkInternal(coverage, fineDelta); checkEdge(coverage, envelope, fineDelta); }
@DescribeResult(description = "Output raster") public GridCoverage2D execute( @DescribeParameter(name = "data", description = "Input features") SimpleFeatureCollection obsFeatures, @DescribeParameter( name = "pixelsPerCell", description = "Resolution used for upsampling (in pixels)", defaultValue = "1", min = 1 ) Integer argPixelsPerCell, @DescribeParameter( name = "gridStrategy", description = "GeoHash grid strategy", defaultValue = "Basic", min = 1 ) String gridStrategy, @DescribeParameter( name = "gridStrategyArgs", description = "Grid strategy arguments", min = 0 ) List<String> gridStrategyArgs, @DescribeParameter(name = "emptyCellValue", description = "Default cell value", min = 0) Float emptyCellValue, @DescribeParameter(name = "scaleMin", description = "Scale minimum", defaultValue = "0") Float scaleMin, @DescribeParameter(name = "scaleMax", description = "Scale maximum", min = 0) Float scaleMax, @DescribeParameter( name = "useLog", description = "Whether to use log values (default=false)", defaultValue = "false" ) Boolean useLog, @DescribeParameter(name = "outputBBOX", description = "Bounding box of the output") ReferencedEnvelope argOutputEnv, @DescribeParameter( name = "outputWidth", description = "Width of output raster in pixels" ) Integer argOutputWidth, @DescribeParameter( name = "outputHeight", description = "Height of output raster in pixels" ) Integer argOutputHeight, ProgressListener monitor) throws ProcessException { try { final GeoHashGrid geoHashGrid = Strategy.valueOf(gridStrategy.toUpperCase()).createNewInstance(); geoHashGrid.setParams(gridStrategyArgs); geoHashGrid.setEmptyCellValue(emptyCellValue); geoHashGrid.setScale(new RasterScale(scaleMin, scaleMax, useLog)); geoHashGrid.initalize(argOutputEnv, obsFeatures); final GridCoverage2D nativeCoverage = geoHashGrid.toGridCoverage2D(); final GridCoverage2D transformedCoverage = (GridCoverage2D) Operations.DEFAULT.resample( nativeCoverage, argOutputEnv.getCoordinateReferenceSystem()); final GridCoverage2D scaledCoverage = GridCoverageUtil.scale( transformedCoverage, argOutputWidth * argPixelsPerCell, argOutputHeight * argPixelsPerCell); final GridCoverage2D croppedCoverage = GridCoverageUtil.crop(scaledCoverage, argOutputEnv); return GridCoverageUtil.scale(croppedCoverage, argOutputWidth, argOutputHeight); } catch (Exception e) { throw new ProcessException("Error executing GeoHashGridProcess", e); } }
GeoHashGridProcess implements VectorProcess { @DescribeResult(description = "Output raster") public GridCoverage2D execute( @DescribeParameter(name = "data", description = "Input features") SimpleFeatureCollection obsFeatures, @DescribeParameter( name = "pixelsPerCell", description = "Resolution used for upsampling (in pixels)", defaultValue = "1", min = 1 ) Integer argPixelsPerCell, @DescribeParameter( name = "gridStrategy", description = "GeoHash grid strategy", defaultValue = "Basic", min = 1 ) String gridStrategy, @DescribeParameter( name = "gridStrategyArgs", description = "Grid strategy arguments", min = 0 ) List<String> gridStrategyArgs, @DescribeParameter(name = "emptyCellValue", description = "Default cell value", min = 0) Float emptyCellValue, @DescribeParameter(name = "scaleMin", description = "Scale minimum", defaultValue = "0") Float scaleMin, @DescribeParameter(name = "scaleMax", description = "Scale maximum", min = 0) Float scaleMax, @DescribeParameter( name = "useLog", description = "Whether to use log values (default=false)", defaultValue = "false" ) Boolean useLog, @DescribeParameter(name = "outputBBOX", description = "Bounding box of the output") ReferencedEnvelope argOutputEnv, @DescribeParameter( name = "outputWidth", description = "Width of output raster in pixels" ) Integer argOutputWidth, @DescribeParameter( name = "outputHeight", description = "Height of output raster in pixels" ) Integer argOutputHeight, ProgressListener monitor) throws ProcessException { try { final GeoHashGrid geoHashGrid = Strategy.valueOf(gridStrategy.toUpperCase()).createNewInstance(); geoHashGrid.setParams(gridStrategyArgs); geoHashGrid.setEmptyCellValue(emptyCellValue); geoHashGrid.setScale(new RasterScale(scaleMin, scaleMax, useLog)); geoHashGrid.initalize(argOutputEnv, obsFeatures); final GridCoverage2D nativeCoverage = geoHashGrid.toGridCoverage2D(); final GridCoverage2D transformedCoverage = (GridCoverage2D) Operations.DEFAULT.resample( nativeCoverage, argOutputEnv.getCoordinateReferenceSystem()); final GridCoverage2D scaledCoverage = GridCoverageUtil.scale( transformedCoverage, argOutputWidth * argPixelsPerCell, argOutputHeight * argPixelsPerCell); final GridCoverage2D croppedCoverage = GridCoverageUtil.crop(scaledCoverage, argOutputEnv); return GridCoverageUtil.scale(croppedCoverage, argOutputWidth, argOutputHeight); } catch (Exception e) { throw new ProcessException("Error executing GeoHashGridProcess", e); } } }
GeoHashGridProcess implements VectorProcess { @DescribeResult(description = "Output raster") public GridCoverage2D execute( @DescribeParameter(name = "data", description = "Input features") SimpleFeatureCollection obsFeatures, @DescribeParameter( name = "pixelsPerCell", description = "Resolution used for upsampling (in pixels)", defaultValue = "1", min = 1 ) Integer argPixelsPerCell, @DescribeParameter( name = "gridStrategy", description = "GeoHash grid strategy", defaultValue = "Basic", min = 1 ) String gridStrategy, @DescribeParameter( name = "gridStrategyArgs", description = "Grid strategy arguments", min = 0 ) List<String> gridStrategyArgs, @DescribeParameter(name = "emptyCellValue", description = "Default cell value", min = 0) Float emptyCellValue, @DescribeParameter(name = "scaleMin", description = "Scale minimum", defaultValue = "0") Float scaleMin, @DescribeParameter(name = "scaleMax", description = "Scale maximum", min = 0) Float scaleMax, @DescribeParameter( name = "useLog", description = "Whether to use log values (default=false)", defaultValue = "false" ) Boolean useLog, @DescribeParameter(name = "outputBBOX", description = "Bounding box of the output") ReferencedEnvelope argOutputEnv, @DescribeParameter( name = "outputWidth", description = "Width of output raster in pixels" ) Integer argOutputWidth, @DescribeParameter( name = "outputHeight", description = "Height of output raster in pixels" ) Integer argOutputHeight, ProgressListener monitor) throws ProcessException { try { final GeoHashGrid geoHashGrid = Strategy.valueOf(gridStrategy.toUpperCase()).createNewInstance(); geoHashGrid.setParams(gridStrategyArgs); geoHashGrid.setEmptyCellValue(emptyCellValue); geoHashGrid.setScale(new RasterScale(scaleMin, scaleMax, useLog)); geoHashGrid.initalize(argOutputEnv, obsFeatures); final GridCoverage2D nativeCoverage = geoHashGrid.toGridCoverage2D(); final GridCoverage2D transformedCoverage = (GridCoverage2D) Operations.DEFAULT.resample( nativeCoverage, argOutputEnv.getCoordinateReferenceSystem()); final GridCoverage2D scaledCoverage = GridCoverageUtil.scale( transformedCoverage, argOutputWidth * argPixelsPerCell, argOutputHeight * argPixelsPerCell); final GridCoverage2D croppedCoverage = GridCoverageUtil.crop(scaledCoverage, argOutputEnv); return GridCoverageUtil.scale(croppedCoverage, argOutputWidth, argOutputHeight); } catch (Exception e) { throw new ProcessException("Error executing GeoHashGridProcess", e); } }  }
GeoHashGridProcess implements VectorProcess { @DescribeResult(description = "Output raster") public GridCoverage2D execute( @DescribeParameter(name = "data", description = "Input features") SimpleFeatureCollection obsFeatures, @DescribeParameter( name = "pixelsPerCell", description = "Resolution used for upsampling (in pixels)", defaultValue = "1", min = 1 ) Integer argPixelsPerCell, @DescribeParameter( name = "gridStrategy", description = "GeoHash grid strategy", defaultValue = "Basic", min = 1 ) String gridStrategy, @DescribeParameter( name = "gridStrategyArgs", description = "Grid strategy arguments", min = 0 ) List<String> gridStrategyArgs, @DescribeParameter(name = "emptyCellValue", description = "Default cell value", min = 0) Float emptyCellValue, @DescribeParameter(name = "scaleMin", description = "Scale minimum", defaultValue = "0") Float scaleMin, @DescribeParameter(name = "scaleMax", description = "Scale maximum", min = 0) Float scaleMax, @DescribeParameter( name = "useLog", description = "Whether to use log values (default=false)", defaultValue = "false" ) Boolean useLog, @DescribeParameter(name = "outputBBOX", description = "Bounding box of the output") ReferencedEnvelope argOutputEnv, @DescribeParameter( name = "outputWidth", description = "Width of output raster in pixels" ) Integer argOutputWidth, @DescribeParameter( name = "outputHeight", description = "Height of output raster in pixels" ) Integer argOutputHeight, ProgressListener monitor) throws ProcessException { try { final GeoHashGrid geoHashGrid = Strategy.valueOf(gridStrategy.toUpperCase()).createNewInstance(); geoHashGrid.setParams(gridStrategyArgs); geoHashGrid.setEmptyCellValue(emptyCellValue); geoHashGrid.setScale(new RasterScale(scaleMin, scaleMax, useLog)); geoHashGrid.initalize(argOutputEnv, obsFeatures); final GridCoverage2D nativeCoverage = geoHashGrid.toGridCoverage2D(); final GridCoverage2D transformedCoverage = (GridCoverage2D) Operations.DEFAULT.resample( nativeCoverage, argOutputEnv.getCoordinateReferenceSystem()); final GridCoverage2D scaledCoverage = GridCoverageUtil.scale( transformedCoverage, argOutputWidth * argPixelsPerCell, argOutputHeight * argPixelsPerCell); final GridCoverage2D croppedCoverage = GridCoverageUtil.crop(scaledCoverage, argOutputEnv); return GridCoverageUtil.scale(croppedCoverage, argOutputWidth, argOutputHeight); } catch (Exception e) { throw new ProcessException("Error executing GeoHashGridProcess", e); } }  @DescribeResult(description = "Output raster") GridCoverage2D execute(

            // process data
            @DescribeParameter(name = "data", description = "Input features")
                    SimpleFeatureCollection obsFeatures,

            // process parameters
            @DescribeParameter(
                        name = "pixelsPerCell",
                        description = "Resolution used for upsampling (in pixels)",
                        defaultValue = "1",
                        min = 1
                    )
                    Integer argPixelsPerCell,
            @DescribeParameter(
                        name = "gridStrategy",
                        description = "GeoHash grid strategy",
                        defaultValue = "Basic",
                        min = 1
                    )
                    String gridStrategy,
            @DescribeParameter(
                        name = "gridStrategyArgs",
                        description = "Grid strategy arguments",
                        min = 0
                    )
                    List<String> gridStrategyArgs,
            @DescribeParameter(name = "emptyCellValue", description = "Default cell value", min = 0)
                    Float emptyCellValue,
            @DescribeParameter(name = "scaleMin", description = "Scale minimum", defaultValue = "0")
                    Float scaleMin,
            @DescribeParameter(name = "scaleMax", description = "Scale maximum", min = 0)
                    Float scaleMax,
            @DescribeParameter(
                        name = "useLog",
                        description = "Whether to use log values (default=false)",
                        defaultValue = "false"
                    )
                    Boolean useLog,

            // output image parameters
            @DescribeParameter(name = "outputBBOX", description = "Bounding box of the output")
                    ReferencedEnvelope argOutputEnv,
            @DescribeParameter(
                        name = "outputWidth",
                        description = "Width of output raster in pixels"
                    )
                    Integer argOutputWidth,
            @DescribeParameter(
                        name = "outputHeight",
                        description = "Height of output raster in pixels"
                    )
                    Integer argOutputHeight,
            ProgressListener monitor); Query invertQuery(
            @DescribeParameter(
                        name = "outputBBOX",
                        description = "Georeferenced bounding box of the output"
                    )
                    ReferencedEnvelope envelope,
            Query targetQuery,
            GridGeometry targetGridGeometry); }
GeoHashGridProcess implements VectorProcess { @DescribeResult(description = "Output raster") public GridCoverage2D execute( @DescribeParameter(name = "data", description = "Input features") SimpleFeatureCollection obsFeatures, @DescribeParameter( name = "pixelsPerCell", description = "Resolution used for upsampling (in pixels)", defaultValue = "1", min = 1 ) Integer argPixelsPerCell, @DescribeParameter( name = "gridStrategy", description = "GeoHash grid strategy", defaultValue = "Basic", min = 1 ) String gridStrategy, @DescribeParameter( name = "gridStrategyArgs", description = "Grid strategy arguments", min = 0 ) List<String> gridStrategyArgs, @DescribeParameter(name = "emptyCellValue", description = "Default cell value", min = 0) Float emptyCellValue, @DescribeParameter(name = "scaleMin", description = "Scale minimum", defaultValue = "0") Float scaleMin, @DescribeParameter(name = "scaleMax", description = "Scale maximum", min = 0) Float scaleMax, @DescribeParameter( name = "useLog", description = "Whether to use log values (default=false)", defaultValue = "false" ) Boolean useLog, @DescribeParameter(name = "outputBBOX", description = "Bounding box of the output") ReferencedEnvelope argOutputEnv, @DescribeParameter( name = "outputWidth", description = "Width of output raster in pixels" ) Integer argOutputWidth, @DescribeParameter( name = "outputHeight", description = "Height of output raster in pixels" ) Integer argOutputHeight, ProgressListener monitor) throws ProcessException { try { final GeoHashGrid geoHashGrid = Strategy.valueOf(gridStrategy.toUpperCase()).createNewInstance(); geoHashGrid.setParams(gridStrategyArgs); geoHashGrid.setEmptyCellValue(emptyCellValue); geoHashGrid.setScale(new RasterScale(scaleMin, scaleMax, useLog)); geoHashGrid.initalize(argOutputEnv, obsFeatures); final GridCoverage2D nativeCoverage = geoHashGrid.toGridCoverage2D(); final GridCoverage2D transformedCoverage = (GridCoverage2D) Operations.DEFAULT.resample( nativeCoverage, argOutputEnv.getCoordinateReferenceSystem()); final GridCoverage2D scaledCoverage = GridCoverageUtil.scale( transformedCoverage, argOutputWidth * argPixelsPerCell, argOutputHeight * argPixelsPerCell); final GridCoverage2D croppedCoverage = GridCoverageUtil.crop(scaledCoverage, argOutputEnv); return GridCoverageUtil.scale(croppedCoverage, argOutputWidth, argOutputHeight); } catch (Exception e) { throw new ProcessException("Error executing GeoHashGridProcess", e); } }  @DescribeResult(description = "Output raster") GridCoverage2D execute(

            // process data
            @DescribeParameter(name = "data", description = "Input features")
                    SimpleFeatureCollection obsFeatures,

            // process parameters
            @DescribeParameter(
                        name = "pixelsPerCell",
                        description = "Resolution used for upsampling (in pixels)",
                        defaultValue = "1",
                        min = 1
                    )
                    Integer argPixelsPerCell,
            @DescribeParameter(
                        name = "gridStrategy",
                        description = "GeoHash grid strategy",
                        defaultValue = "Basic",
                        min = 1
                    )
                    String gridStrategy,
            @DescribeParameter(
                        name = "gridStrategyArgs",
                        description = "Grid strategy arguments",
                        min = 0
                    )
                    List<String> gridStrategyArgs,
            @DescribeParameter(name = "emptyCellValue", description = "Default cell value", min = 0)
                    Float emptyCellValue,
            @DescribeParameter(name = "scaleMin", description = "Scale minimum", defaultValue = "0")
                    Float scaleMin,
            @DescribeParameter(name = "scaleMax", description = "Scale maximum", min = 0)
                    Float scaleMax,
            @DescribeParameter(
                        name = "useLog",
                        description = "Whether to use log values (default=false)",
                        defaultValue = "false"
                    )
                    Boolean useLog,

            // output image parameters
            @DescribeParameter(name = "outputBBOX", description = "Bounding box of the output")
                    ReferencedEnvelope argOutputEnv,
            @DescribeParameter(
                        name = "outputWidth",
                        description = "Width of output raster in pixels"
                    )
                    Integer argOutputWidth,
            @DescribeParameter(
                        name = "outputHeight",
                        description = "Height of output raster in pixels"
                    )
                    Integer argOutputHeight,
            ProgressListener monitor); Query invertQuery(
            @DescribeParameter(
                        name = "outputBBOX",
                        description = "Georeferenced bounding box of the output"
                    )
                    ReferencedEnvelope envelope,
            Query targetQuery,
            GridGeometry targetGridGeometry);  }