Java Code Examples for org.geotools.coverage.grid.GridCoverage2D#getRenderedImage()
The following examples show how to use
org.geotools.coverage.grid.GridCoverage2D#getRenderedImage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestHackLength.java From hortonmachine with GNU General Public License v3.0 | 6 votes |
public void testHacklength3d() throws IOException { HashMap<String, Double> envelopeParams = HMTestMaps.getEnvelopeparams(); CoordinateReferenceSystem crs = HMTestMaps.getCrs(); double[][] pitData = HMTestMaps.pitData; GridCoverage2D pitCoverage = CoverageUtilities.buildCoverage("pit", pitData, envelopeParams, crs, true); double[][] flowData = HMTestMaps.mflowDataBorder; GridCoverage2D flowCoverage = CoverageUtilities.buildCoverage("flow", flowData, envelopeParams, crs, true); double[][] tcaData = HMTestMaps.tcaData; GridCoverage2D tcaCoverage = CoverageUtilities.buildCoverage("tca", tcaData, envelopeParams, crs, true); OmsHackLength hackLength = new OmsHackLength(); hackLength.inFlow = flowCoverage; hackLength.inTca = tcaCoverage; hackLength.inElevation = pitCoverage; hackLength.pm = pm; hackLength.process(); GridCoverage2D hackLengthCoverage = hackLength.outHacklength; RenderedImage renderedImage = hackLengthCoverage.getRenderedImage(); checkMatrixEqual(renderedImage, HMTestMaps.hacklength3DData, 2); }
Example 2
Source File: TestMapcalc.java From hortonmachine with GNU General Public License v3.0 | 6 votes |
public void testMapcalc3() throws Exception { double[][] elevationData = HMTestMaps.pitData; HashMap<String, Double> envelopeParams = HMTestMaps.getEnvelopeparams(); CoordinateReferenceSystem crs = HMTestMaps.getCrs(); GridCoverage2D elevationCoverage = CoverageUtilities.buildCoverage("ele", elevationData, envelopeParams, crs, true); List<GridCoverage2D> maps = Arrays.asList(elevationCoverage); OmsMapcalc mapcalc = new OmsMapcalc(); mapcalc.inRasters = maps; mapcalc.pFunction = "images{ele=read; dest=write;} dest = xres()*yres();"; mapcalc.process(); GridCoverage2D outMap = mapcalc.outRaster; RenderedImage renderedImage = outMap.getRenderedImage(); // printImage(renderedImage); checkEqualsSinlgeValue(renderedImage, 900.0, 0.000000001); }
Example 3
Source File: TestMapcalc.java From hortonmachine with GNU General Public License v3.0 | 6 votes |
public void testMapcalc2() throws Exception { double[][] elevationData = HMTestMaps.flowData; HashMap<String, Double> envelopeParams = HMTestMaps.getEnvelopeparams(); CoordinateReferenceSystem crs = HMTestMaps.getCrs(); GridCoverage2D elevationCoverage = CoverageUtilities.buildCoverage("flow", elevationData, envelopeParams, crs, true); List<GridCoverage2D> maps = Arrays.asList(elevationCoverage); OmsMapcalc mapcalc = new OmsMapcalc(); mapcalc.inRasters = maps; mapcalc.pFunction = "images{flow=read; dest=write;} dest = (flow+flow)/2;"; mapcalc.process(); GridCoverage2D outMap = mapcalc.outRaster; RenderedImage renderedImage = outMap.getRenderedImage(); printImage(renderedImage); checkMatrixEqual(renderedImage, HMTestMaps.flowData, 0.000000001); }
Example 4
Source File: TestRasterHoleFiller.java From hortonmachine with GNU General Public License v3.0 | 6 votes |
public void testHoleFiller() throws Exception { HashMap<String, Double> envelopeParams = HMTestMaps.getEnvelopeparams(); CoordinateReferenceSystem crs = HMTestMaps.getCrs(); GridCoverage2D inCoverage = CoverageUtilities.buildCoverage("data", data, envelopeParams, crs, true); OmsHoleFiller transformer = new OmsHoleFiller(); transformer.inRaster = inCoverage; transformer.pMode = Variables.IDW; transformer.pBuffer = 10000; transformer.process(); GridCoverage2D outCoverage = transformer.outRaster; double[][] expected = new double[][]{// /* */{5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0}, // {5.0, 5.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 5.0}, // {5.0, 7.0, 6.0, 6.0, 6.0, 6.0, 6.0, 7.0, 7.0, 5.0}, // {5.0, 5.0, 5.0, 7.0, 6.0, 6.0, 6.0, 6.0, 5.0, 5.0}, // {5.0, 4.6000000000000005, 4.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0}, // {5.0, 4.32, 3.0, 3.0, 4.0, 4.0, 4.0, 3.0, 3.0, 5.0}, // {5.0, 4.553333333333334, 4.0, 4.0, 4.0, 4.0, 5.0, 4.0, 4.0, 5.0}, // {5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0} // }; RenderedImage renderedImage = outCoverage.getRenderedImage(); checkMatrixEqual(renderedImage, expected); }
Example 5
Source File: PrintUtilities.java From hortonmachine with GNU General Public License v3.0 | 5 votes |
/** * Print data of a {@link GridCoverage2D} as java matrix definition. * * @param coverage * the coverage. */ public static void printCoverageDataAsMatrix( GridCoverage2D coverage ) { printer.println("double[][] matrix = new double[][]{//"); RenderedImage renderedImage = coverage.getRenderedImage(); RandomIter renderedImageIterator = RandomIterFactory.create(renderedImage, null); int[] colsRows = CoverageUtilities.getRegionColsRows(coverage); for( int r = 0; r < colsRows[1]; r++ ) { if (r == 0) { printer.print("/* */{"); } else { printer.print("{"); } for( int c = 0; c < colsRows[0]; c++ ) { printer.print(renderedImageIterator.getSampleDouble(c, r, 0)); if (c < colsRows[0] - 1) { printer.print(", "); } } if (r < colsRows[1] - 1) { printer.println("}, //"); } else { printer.println("} //"); } } printer.println("};"); renderedImageIterator.done(); }
Example 6
Source File: QABandToIceMaskConverter.java From geowave with Apache License 2.0 | 5 votes |
@Override public GridCoverage2D convert( final String coverageName, final GridCoverage2D originalBandData, final SimpleFeature bandMetadata) { final Object attrValue = bandMetadata.getAttribute(BandFeatureIterator.BAND_ATTRIBUTE_NAME); if ("BQA".equalsIgnoreCase(attrValue.toString())) { final MultiPixelPackedSampleModel newSampleModel = new MultiPixelPackedSampleModel( DataBuffer.TYPE_BYTE, originalBandData.getRenderedImage().getWidth(), originalBandData.getRenderedImage().getHeight(), 2); final WritableRaster nextRaster = Raster.createWritableRaster(newSampleModel, null); final RenderedImage image = originalBandData.getRenderedImage(); final Raster data = image.getData(); for (int x = 0; x < data.getWidth(); x++) { for (int y = 0; y < data.getHeight(); y++) { final int sample = getIceSample(x, y, data); nextRaster.setSample(x, y, 0, sample); } } final GridCoverage2D nextCov = new GridCoverageFactory().create( coverageName, nextRaster, originalBandData.getEnvelope()); return nextCov; } return originalBandData; }
Example 7
Source File: TestMapcalc.java From hortonmachine with GNU General Public License v3.0 | 5 votes |
public void testMapcalc() throws Exception { double[][] elevationData = HMTestMaps.pitData; HashMap<String, Double> envelopeParams = HMTestMaps.getEnvelopeparams(); CoordinateReferenceSystem crs = HMTestMaps.getCrs(); GridCoverage2D elevationCoverage = CoverageUtilities.buildCoverage("ele", elevationData, envelopeParams, crs, true); List<GridCoverage2D> maps = Arrays.asList(elevationCoverage); OmsMapcalc mapcalc = new OmsMapcalc(); mapcalc.inRasters = maps; mapcalc.pFunction = "images{ele=read; dest=write;} dest=ele*2-ele + sqrt(ele)^2-exp(log(ele));"; mapcalc.process(); GridCoverage2D outMap = mapcalc.outRaster; RenderedImage renderedImage = outMap.getRenderedImage(); // printImage(renderedImage); double[][] expectedData = new double[][]{// {800, 900, 1000, 1000, 1200, 1250, 1300, 1350, 1450, 1500}, // {600, Double.NaN, 750, 850, 860, 900, 1000, 1200, 1250, 1500}, // {500, 550, 700, 750, 800, 850, 900, 1000, 1100, 1500}, // {400, 410, 650, 700, 750, 800, 850, 800, 800, 1500}, // {450, 550, 430, 500, 600, 700, 800, 800, 800, 1500}, // {500, 600, 700, 750, 760, 770, 850, 1000, 1150, 1500}, // {600, 700, 750, 800, 780, 790, 1000, 1100, 1250, 1500}, // {800, 910, 980, 1001, 1150, 1200, 1250, 1300, 1450, 1500}}; checkMatrixEqual(renderedImage, expectedData, 0.000000001); }
Example 8
Source File: GridCoverageUtil.java From elasticgeo with GNU General Public License v3.0 | 5 votes |
public static GridCoverage2D scale(GridCoverage2D coverage, float width, float height) { final RenderedImage renderedImage = coverage.getRenderedImage(); final Raster renderedGrid = renderedImage.getData(); float yScale = width/renderedGrid.getWidth(); float xScale = height/renderedGrid.getHeight(); final Operations ops = new Operations(null); return (GridCoverage2D) ops.scale(coverage, xScale, yScale, 0, 0); }
Example 9
Source File: PrintUtilities.java From hortonmachine with GNU General Public License v3.0 | 5 votes |
/** * Print data of a {@link GridCoverage2D}. * * @param coverage * the coverage. */ public static void printCoverageData( GridCoverage2D coverage ) { RenderedImage renderedImage = coverage.getRenderedImage(); RandomIter renderedImageIterator = RandomIterFactory.create(renderedImage, null); int[] colsRows = CoverageUtilities.getRegionColsRows(coverage); for( int r = 0; r < colsRows[1]; r++ ) { for( int c = 0; c < colsRows[0]; c++ ) { printer.print(renderedImageIterator.getSampleDouble(c, r, 0)); printer.print(separator); } printer.println(); } }
Example 10
Source File: CoverageUtilities.java From hortonmachine with GNU General Public License v3.0 | 5 votes |
/** * Calculates the profile of a raster map between given {@link Coordinate coordinates}. * * @param coverage the coverage from which to extract the profile. * @param coordinates the coordinates to use to trace the profile. * @return the list of {@link ProfilePoint}s. * @throws Exception */ public static List<ProfilePoint> doProfile( GridCoverage2D coverage, Coordinate... coordinates ) throws Exception { GridGeometry2D gridGeometry = coverage.getGridGeometry(); RenderedImage renderedImage = coverage.getRenderedImage(); RandomIter iter = RandomIterFactory.create(renderedImage, null); List<ProfilePoint> profilePointsList = doProfile(iter, gridGeometry, coordinates); iter.done(); return profilePointsList; }
Example 11
Source File: CoverageUtilities.java From hortonmachine with GNU General Public License v3.0 | 5 votes |
/** * Creates a {@link RandomIter} for the given {@link GridCoverage2D}. * * <p>It is important to use this method since it supports also * large GRASS rasters. * * @param coverage the coverage on which to wrap a {@link RandomIter}. * @return the iterator. */ public static RandomIter getRandomIterator( GridCoverage2D coverage ) { // if (coverage instanceof GrassLegacyGridCoverage2D) { // GrassLegacyGridCoverage2D grassGC = (GrassLegacyGridCoverage2D) coverage; // GrassLegacyRandomIter iter = new GrassLegacyRandomIter(grassGC.getData()); // return iter; // } RenderedImage renderedImage = coverage.getRenderedImage(); RandomIter iter = RandomIterFactory.create(renderedImage, null); return iter; }
Example 12
Source File: GridCoverageUtilTest.java From elasticgeo with GNU General Public License v3.0 | 5 votes |
@Test public void testCrop() throws MismatchedDimensionException { float[][] grid = new float[][] {{3,4},{1,2}}; final GridCoverageFactory coverageFactory = CoverageFactoryFinder.getGridCoverageFactory(GeoTools.getDefaultHints()); final GridCoverage2D coverage = coverageFactory.create("geohashGridAgg", grid, new ReferencedEnvelope(0,20,0,20,null)); final ReferencedEnvelope envelope = new ReferencedEnvelope(10,20,10,20,null); final GridCoverage2D croppedCoverage = GridCoverageUtil.crop(coverage, envelope); final RenderedImage renderedImage = croppedCoverage.getRenderedImage(); assertEquals(1, renderedImage.getWidth()); assertEquals(1, renderedImage.getHeight()); assertEquals(4, croppedCoverage.evaluate(new Point2D.Double(15,15), new float[1])[0], 1e-10); }
Example 13
Source File: GridCoverageUtilTest.java From elasticgeo with GNU General Public License v3.0 | 5 votes |
@Test public void testLargeScale() { float[][] grid = new float[2][2]; final GridCoverageFactory coverageFactory = CoverageFactoryFinder.getGridCoverageFactory(GeoTools.getDefaultHints()); final GridCoverage2D coverage = coverageFactory.create("geohashGridAgg", grid, new ReferencedEnvelope(0,1,0,1,null)); GridCoverage2D scaled = GridCoverageUtil.scale(coverage, 1501, 1499); final RenderedImage renderedImage = scaled.getRenderedImage(); assertEquals(1499, renderedImage.getWidth()); assertEquals(1501, renderedImage.getHeight()); }
Example 14
Source File: GridCoverageUtilTest.java From elasticgeo with GNU General Public License v3.0 | 5 votes |
@Test public void testSmallScale() { float[][] grid = new float[1500][1500]; final GridCoverageFactory coverageFactory = CoverageFactoryFinder.getGridCoverageFactory(GeoTools.getDefaultHints()); final GridCoverage2D coverage = coverageFactory.create("geohashGridAgg", grid, new ReferencedEnvelope(0,1,0,1,null)); GridCoverage2D scaled = GridCoverageUtil.scale(coverage, 1501, 1499); final RenderedImage renderedImage = scaled.getRenderedImage(); assertEquals(1499, renderedImage.getWidth()); assertEquals(1501, renderedImage.getHeight()); }
Example 15
Source File: GridCoverageUtilTest.java From elasticgeo with GNU General Public License v3.0 | 5 votes |
@Test public void testInexactScale() { float[][] grid = new float[][] {{1,2},{3,4}}; final GridCoverageFactory coverageFactory = CoverageFactoryFinder.getGridCoverageFactory(GeoTools.getDefaultHints()); final GridCoverage2D coverage = coverageFactory.create("geohashGridAgg", grid, new ReferencedEnvelope(0,1,0,1,null)); GridCoverage2D scaled = GridCoverageUtil.scale(coverage, 3, 7); final RenderedImage renderedImage = scaled.getRenderedImage(); assertEquals(7, renderedImage.getWidth()); assertEquals(3, renderedImage.getHeight()); }
Example 16
Source File: GridCoverageUtilTest.java From elasticgeo with GNU General Public License v3.0 | 5 votes |
@Test public void testExactDownScale() { float[][] grid = new float[][] {{1,1,2,2},{1,1,2,2},{3,3,4,4},{3,3,4,4}}; final GridCoverageFactory coverageFactory = CoverageFactoryFinder.getGridCoverageFactory(GeoTools.getDefaultHints()); final GridCoverage2D coverage = coverageFactory.create("geohashGridAgg", grid, new ReferencedEnvelope(0,1,0,1,null)); GridCoverage2D scaled = GridCoverageUtil.scale(coverage, 2,2); final RenderedImage renderedImage = scaled.getRenderedImage(); assertEquals(2, renderedImage.getWidth()); assertEquals(2, renderedImage.getHeight()); float[][] expected = new float[][] {{1,2},{3,4}}; IntStream.range(0,2).forEach(i->IntStream.range(0, 2).forEach(j -> { float actual = scaled.evaluate(new GridCoordinates2D(j,i), new float[1])[0]; assertEquals(expected[i][j], actual, 1e-10); })); }
Example 17
Source File: GridCoverageUtilTest.java From elasticgeo with GNU General Public License v3.0 | 5 votes |
@Test public void testExactUpScale() { float[][] grid = new float[][] {{1,2},{3,4}}; final GridCoverageFactory coverageFactory = CoverageFactoryFinder.getGridCoverageFactory(GeoTools.getDefaultHints()); final GridCoverage2D coverage = coverageFactory.create("geohashGridAgg", grid, new ReferencedEnvelope(0,1,0,1,null)); GridCoverage2D scaled = GridCoverageUtil.scale(coverage, 4, 4); final RenderedImage renderedImage = scaled.getRenderedImage(); assertEquals(4, renderedImage.getWidth()); assertEquals(4, renderedImage.getHeight()); float[][] expected = new float[][] {{1,1,2,2},{1,1,2,2},{3,3,4,4},{3,3,4,4}}; IntStream.range(0,4).forEach(i->IntStream.range(0, 4).forEach(j -> { float actual = scaled.evaluate(new GridCoordinates2D(j,i), new float[1])[0]; assertEquals(expected[i][j], actual, 1e-10); })); }
Example 18
Source File: OmsMapsViewer.java From hortonmachine with GNU General Public License v3.0 | 4 votes |
private void addCoverages( final MapContent map ) throws Exception { if (inRasters == null) { return; } RasterSymbolizer rasterSym = sf.createRasterSymbolizer(); ColorMap colorMap = sf.createColorMap(); for( String rasterPath : inRasters ) { GridCoverage2D readRaster = OmsRasterReader.readRaster(rasterPath); RenderedImage renderedImage = readRaster.getRenderedImage(); double max = Double.NEGATIVE_INFINITY; double min = Double.POSITIVE_INFINITY; RectIter iter = RectIterFactory.create(renderedImage, null); do { do { double value = iter.getSampleDouble(); if (value > max) { max = value; } if (value < min) { min = value; } } while( !iter.nextPixelDone() ); iter.startPixels(); } while( !iter.nextLineDone() ); // red to blue Color fromColor = Color.blue; Color midColor = Color.green; Color toColor = Color.red; Expression fromColorExpr = sb .colorExpression(new java.awt.Color(fromColor.getRed(), fromColor.getGreen(), fromColor.getBlue(), 255)); Expression midColorExpr = sb .colorExpression(new java.awt.Color(midColor.getRed(), midColor.getGreen(), midColor.getBlue(), 255)); Expression toColorExpr = sb .colorExpression(new java.awt.Color(toColor.getRed(), toColor.getGreen(), toColor.getBlue(), 255)); Expression fromExpr = sb.literalExpression(min); Expression midExpr = sb.literalExpression(min + (max - min) / 2); Expression toExpr = sb.literalExpression(max); ColorMapEntry entry = sf.createColorMapEntry(); entry.setQuantity(fromExpr); entry.setColor(fromColorExpr); colorMap.addColorMapEntry(entry); entry = sf.createColorMapEntry(); entry.setQuantity(midExpr); entry.setColor(midColorExpr); colorMap.addColorMapEntry(entry); entry = sf.createColorMapEntry(); entry.setQuantity(toExpr); entry.setColor(toColorExpr); colorMap.addColorMapEntry(entry); rasterSym.setColorMap(colorMap); Style rasterStyle = SLD.wrapSymbolizers(rasterSym); GridCoverageLayer layer = new GridCoverageLayer(readRaster, rasterStyle); map.addLayer(layer); } }
Example 19
Source File: OmsDebrisTriggerCnr.java From hortonmachine with GNU General Public License v3.0 | 4 votes |
@Execute public void process() throws Exception { checkNull(inElev, inNet, inTca); // calculate gradient map degrees OmsGradient gradient = new OmsGradient(); gradient.inElev = inElev; gradient.pMode = Variables.FINITE_DIFFERENCES; gradient.doDegrees = true; gradient.pm = pm; gradient.process(); GridCoverage2D gradientCoverageDeg = gradient.outSlope; // calculate gradient map % gradient = new OmsGradient(); gradient.inElev = inElev; gradient.pMode = Variables.FINITE_DIFFERENCES; gradient.doDegrees = false; gradient.pm = pm; gradient.process(); GridCoverage2D gradientCoverageTan = gradient.outSlope; // ritaglio della mappa di gradient lungo il reticolo // idrografico ed estrazione delle sole celle con // * pendenza minore di 38 gradi // * area cumulata minore di 10 km2 RegionMap regionMap = CoverageUtilities.getRegionParamsFromGridCoverage(inElev); int cols = regionMap.getCols(); int rows = regionMap.getRows(); double xres = regionMap.getXres(); double yres = regionMap.getYres(); RenderedImage netRI = inNet.getRenderedImage(); RandomIter netIter = RandomIterFactory.create(netRI, null); RenderedImage tcaRI = inTca.getRenderedImage(); RandomIter tcaIter = RandomIterFactory.create(tcaRI, null); RenderedImage gradientDegRI = gradientCoverageDeg.getRenderedImage(); RandomIter gradientDegIter = RandomIterFactory.create(gradientDegRI, null); RenderedImage gradientTanRI = gradientCoverageTan.getRenderedImage(); RandomIter gradientTanIter = RandomIterFactory.create(gradientTanRI, null); WritableRaster outputWR = CoverageUtilities.createWritableRaster(cols, rows, null, null, HMConstants.doubleNovalue); WritableRandomIter outputIter = RandomIterFactory.createWritable(outputWR, null); pm.beginTask("Extracting trigger points...", cols); for( int r = 0; r < rows; r++ ) { for( int c = 0; c < cols; c++ ) { double net = netIter.getSampleDouble(c, r, 0); // all only along the network if (!isNovalue(net)) { double tca = tcaIter.getSampleDouble(c, r, 0); // tca in km2 along the net double tcaKm2 = tca * xres * yres / 1000000; // gradient in degrees along the net double gradientDeg = gradientDegIter.getSampleDouble(c, r, 0); // gradient in tan along the net double gradientTan = gradientTanIter.getSampleDouble(c, r, 0); /* * calculate the trigger threshold: * * S = 0.32 * A^-0.2 * where: * S = gradient in m/m * A = tca in km2 */ double triggerThreshold = 0.32 * pow(tcaKm2, -0.2); if (gradientTan > triggerThreshold // && gradientDeg < pGradthres // && tcaKm2 < pTcathres) { // we have a trigger point outputIter.setSample(c, r, 0, triggerThreshold); } } } pm.worked(1); } pm.done(); outTriggers = CoverageUtilities.buildCoverage("triggers", outputWR, regionMap, inElev.getCoordinateReferenceSystem()); }
Example 20
Source File: LandsatIT.java From geowave with Apache License 2.0 | 4 votes |
@Test public void testMosaic() throws Exception { // Skip this test if we're on a Mac org.junit.Assume.assumeTrue(isNotMac()); JAIExt.initJAIEXT(); MapProjection.SKIP_SANITY_CHECKS = true; // just use the QA band as QA is the smallest, get the best cloud cover, // but ensure it is before now so no recent collection affects the test final Landsat8BasicCommandLineOptions analyzeOptions = new Landsat8BasicCommandLineOptions(); analyzeOptions.setCqlFilter( String.format( "BBOX(%s,%f,%f,%f,%f) AND %s='B4' AND %s <= '%s' AND path >= %d AND path <= %d AND row >= %d AND row <= %d", SceneFeatureIterator.SHAPE_ATTRIBUTE_NAME, WEST, SOUTH, EAST, NORTH, BandFeatureIterator.BAND_ATTRIBUTE_NAME, SceneFeatureIterator.ACQUISITION_DATE_ATTRIBUTE_NAME, "2016-06-01T00:00:00Z", MIN_PATH, MAX_PATH, MIN_ROW, MAX_ROW)); analyzeOptions.setNBestPerSpatial(true); analyzeOptions.setNBestScenes(1); analyzeOptions.setUseCachedScenes(true); final Landsat8DownloadCommandLineOptions downloadOptions = new Landsat8DownloadCommandLineOptions(); final Landsat8RasterIngestCommandLineOptions ingestOptions = new Landsat8RasterIngestCommandLineOptions(); ingestOptions.setRetainImages(true); ingestOptions.setCreatePyramid(true); ingestOptions.setCreateHistogram(true); ingestOptions.setCoverageName("test"); // crop to the specified bbox ingestOptions.setCropToSpatialConstraint(true); final RasterIngestTester runner = new RasterIngestTester( dataStoreOptions, analyzeOptions, downloadOptions, ingestOptions, null); runner.runInternal(null); final StringBuilder str = new StringBuilder(StoreFactoryOptions.GEOWAVE_NAMESPACE_OPTION).append("=").append( dataStoreOptions.getGeoWaveNamespace()).append( ";equalizeHistogramOverride=false;interpolationOverride=").append( Interpolation.INTERP_NEAREST); str.append(";").append(GeoWaveStoreFinder.STORE_HINT_KEY).append("=").append( dataStoreOptions.getType()); final Map<String, String> options = dataStoreOptions.getOptionsAsMap(); for (final Entry<String, String> entry : options.entrySet()) { if (!entry.getKey().equals(StoreFactoryOptions.GEOWAVE_NAMESPACE_OPTION)) { str.append(";").append(entry.getKey()).append("=").append(entry.getValue()); } } final GeneralEnvelope queryEnvelope = new GeneralEnvelope(new double[] {WEST, SOUTH}, new double[] {EAST, NORTH}); queryEnvelope.setCoordinateReferenceSystem(GeometryUtils.getDefaultCRS()); final GeoWaveRasterReader reader = new GeoWaveRasterReader(GeoWaveRasterConfig.readFromConfigParams(str.toString())); final GridCoverage2D gridCoverage = reader.renderGridCoverage( "test", new Rectangle(0, 0, 1024, 1024), queryEnvelope, null, null, null); final RenderedImage result = gridCoverage.getRenderedImage(); // test the result with expected, allowing for minimal error final BufferedImage reference = ImageIO.read(new File(REFERENCE_LANDSAT_IMAGE_PATH)); TestUtils.testTileAgainstReference( PlanarImage.wrapRenderedImage(result).getAsBufferedImage(), reference, 0, 0.005); MapProjection.SKIP_SANITY_CHECKS = false; }