Package org.geotools.coverage.grid

Examples of org.geotools.coverage.grid.GridCoverage2D.evaluate()


            sb.append("The coverage information could not be read.");
        } else if (isOnGrid) {
            int bands = coverage.getSampleDimensions().length;
            final double[] evaluated = new double[bands];
            try {
                coverage.evaluate(p, evaluated);
            } catch (Exception e) {
                e.printStackTrace();
            }
            final GridCoordinates2D gridCoord = gridGeometry.worldToGrid(new DirectPosition2D(p));
            sb.append("Coverage info:\n\n");
View Full Code Here


                        LOGGER.fine("Unable to load raster data for this request.");
                      return;
                    }

                    try {
                        final double[] pixelValues = coverage.evaluate(position,(double[]) null);
                        final FeatureCollection<SimpleFeatureType, SimpleFeature> pixel;
                        pixel = wrapPixelInFeatureCollection(coverage, pixelValues, cinfo.getQualifiedName());
                        metas.add(requestedLayers[i]);
                        results.add(pixel);
                    } catch(PointOutsideCoverageException e) {
View Full Code Here

            assertNotNull(names);
            assertEquals(2,names.length);
            assertEquals("ROOT/LEVEL1/V2",names[0]);
            GridCoverage2D grid = reader.read("ROOT/LAI", null);
            assertNotNull(grid);
            byte[] byteValue = grid.evaluate(new
                    DirectPosition2D(DefaultGeographicCRS.WGS84, 12, 70 ), new byte[1]);
            assertEquals(20,byteValue[0]);

            byteValue = grid.evaluate(new
                    DirectPosition2D(DefaultGeographicCRS.WGS84, 23, 40), new byte[1]);
View Full Code Here

            assertNotNull(grid);
            byte[] byteValue = grid.evaluate(new
                    DirectPosition2D(DefaultGeographicCRS.WGS84, 12, 70 ), new byte[1]);
            assertEquals(20,byteValue[0]);

            byteValue = grid.evaluate(new
                    DirectPosition2D(DefaultGeographicCRS.WGS84, 23, 40), new byte[1]);
            assertEquals(90,byteValue[0]);


        } finally {
View Full Code Here

            assertNotNull(names);
            assertEquals(2,names.length);

            GridCoverage2D grid = reader.read("O3", null);
            assertNotNull(grid);
            float[] value = grid.evaluate((DirectPosition) new
                    DirectPosition2D(DefaultGeographicCRS.WGS84, 5, 45 ), new float[1]);
            assertEquals(47.63341f,value[0],0.00001);

            value = grid.evaluate((DirectPosition) new
                    DirectPosition2D(DefaultGeographicCRS.WGS84, 5, 45.125), new float[1]);
View Full Code Here

            assertNotNull(grid);
            float[] value = grid.evaluate((DirectPosition) new
                    DirectPosition2D(DefaultGeographicCRS.WGS84, 5, 45 ), new float[1]);
            assertEquals(47.63341f,value[0],0.00001);

            value = grid.evaluate((DirectPosition) new
                    DirectPosition2D(DefaultGeographicCRS.WGS84, 5, 45.125), new float[1]);
            assertEquals(52.7991f, value[0],0.000001);


        } finally {
View Full Code Here

        // Evaluation of the same position
        DirectPosition2D pos = new DirectPosition2D(cov.getEnvelope2D().getCenterX(), cov
                .getEnvelope2D().getCenterY());
       
        assertArrayEquals(response.evaluate(pos, new byte[1]), cov.evaluate(pos, new byte[1]));
    }

}
View Full Code Here

            GridCoverage2D grid = reader.read(names[0], null);
            Assert.assertNotNull(grid);
            // Selection of one coordinate from the Coverage and check if the
            // value is not a NaN
            float[] result = new float[1];
            grid.evaluate(validPoint, result);
            Assert.assertTrue(!Float.isNaN(result[0]));
            // Selection of one coordinate from the Coverage and check if the
            // value is NaN
            float[] result_2 = new float[1];
            grid.evaluate(nodataPoint, result_2);
View Full Code Here

            grid.evaluate(validPoint, result);
            Assert.assertTrue(!Float.isNaN(result[0]));
            // Selection of one coordinate from the Coverage and check if the
            // value is NaN
            float[] result_2 = new float[1];
            grid.evaluate(nodataPoint, result_2);
            Assert.assertTrue(Float.isNaN(result_2[0]));
        } finally {
            if (reader != null) {
                try {
                    reader.dispose();
View Full Code Here

            for (gridP.y = 0; gridP.y < gridDim.height; gridP.y++) {
                for (gridP.x = 0; gridP.x < gridDim.width; gridP.x++) {
                    mt.transform(gridP, geoP);
                }

                cov.evaluate(geoP, covValue);
                if (covValue[0] != 0) {
                    assertTrue(rects.get(covValue[0]).contains(geoP.x, geoP.y));
                }
            }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.