Package org.geotools.coverage.grid

Examples of org.geotools.coverage.grid.GridCoordinates2D


            try {
                coverage.evaluate(p, evaluated);
            } catch (Exception e) {
                e.printStackTrace();
            }
            final GridCoordinates2D gridCoord = gridGeometry.worldToGrid(new DirectPosition2D(p));
            sb.append("Coverage info:\n\n");
            int length = evaluated.length;
            if (length > 1) {
                for( int i = 0; i < evaluated.length; i++ ) {
                    sb.append("Band ").append(i);
View Full Code Here


        long t0 = System.currentTimeMillis();
        CoordinateReferenceSystem crs = gg.getCoordinateReferenceSystem2D();
        try {
            MathTransform tr = CRS.findMathTransform(crs, DefaultGeographicCRS.WGS84);
            // grid coordinate object to be reused for examining each cell
            GridCoordinates2D coord = new GridCoordinates2D();
            int i = 0, ns = 0;
            for (int gy = 0; gy < height; gy++) {
                for (int gx = 0; gx < width; gx++) {
                    coord.x = gx;
                    coord.y = gy;
View Full Code Here

        CoordinateReferenceSystem crs = gg.getCoordinateReferenceSystem2D();
        int i = 0;
        try {
            MathTransform tr = CRS.findMathTransform(crs, DefaultGeographicCRS.WGS84);
            // grid coordinate object to be reused for examining each cell
            GridCoordinates2D coord = new GridCoordinates2D();
            for (int gy = 0; gy < height; gy++) {
                if (gy % 100 == 0)
                    LOG.trace("raster line {} / {}", gy, height);
                for (int gx = 0; gx < width; gx++) {
                    coord.x = gx;
View Full Code Here

            LOG.equals("error creating CRS transform.");
            e.printStackTrace();
            return;
        }
        // grid coordinate object to be reused for reading each cell in the raster
        GridCoordinates2D coord = new GridCoordinates2D();
        // evaluating a raster returns an array of results, in this case 1D
        int[] val = new int[1];
        for (int row = 0; row < rows; row++) {
            for (int col = 0; col < cols; col++) {
                coord.x = col;
View Full Code Here

        /*
         * Verify each vertex is the correct value
         */
        SimpleFeatureIterator iter = features.features();
        float[] covValue = new float[1];
        GridCoordinates2D gridP = new GridCoordinates2D();
        while (iter.hasNext()) {
            SimpleFeature feature = iter.next();
            Coordinate[] coords = ((Geometry)feature.getDefaultGeometry()).getCoordinates();
            for (Coordinate coord : coords) {
                gridP.x = coord.x == gridDim.width ? (int)coord.x-1 : (int)coord.x;
View Full Code Here

        /*
         * Verify each vertex is the correct value
         */
        SimpleFeatureIterator iter = features.features();
        int[] covValue = new int[1];
        GridCoordinates2D gridP = new GridCoordinates2D();
        while (iter.hasNext()) {
            SimpleFeature feature = iter.next();
            Coordinate[] coords = ((Geometry)feature.getDefaultGeometry()).getCoordinates();
            for (Coordinate coord : coords) {
                gridP.x = coord.x == gridDim.width ? (int)coord.x-1 : (int)coord.x;
View Full Code Here

        WKTReader reader = new WKTReader();

        DefaultFeatureCollection fc = new DefaultFeatureCollection();
        Random rand = new Random();
       
        GridCoordinates2D gridPos = new GridCoordinates2D();
        int i = 1;
        for (int y = 0; y < gridDim.height; y++) {
            for (int x = 0; x < gridDim.width; x++) {
                if (rand.nextDouble() < PROB_POINT) {
                    gridPos.setLocation(x, y);
                    DirectPosition worldPos = gridGeom.gridToWorld(gridPos);
                   
                    String wkt = String.format(Locale.US, "MULTIPOINT((%f %f))",
                            worldPos.getOrdinate(0), worldPos.getOrdinate(1));
                    fc.add( buildFeature(builder, reader, wkt, "p" + i, i ) );
View Full Code Here

        // Go through coordinate array in order received
        DirectPosition2D worldPos = new DirectPosition2D();
        for (int n = 0; n < coords.length; n++) {
            worldPos.setLocation(coords[n].x, coords[n].y);
            GridCoordinates2D gridPos = gridGeom.worldToGrid(worldPos);
            coordGridX[n] = gridPos.x;
            coordGridY[n] = gridPos.y;
        }

        switch (geomType) {
View Full Code Here

        assertEquals(height, grid.getGridGeometry().getGridRange().getSpan(1));
       
        double sum = 0.0;
        for (int i = 0; i < width; i++) {
            for (int j = 0; j < height; j++) {
                GridCoordinates2D gridCoordinate = new GridCoordinates2D(i, j);
                float[] band = new float[1];
                float[] result = grid.evaluate(gridCoordinate, band);
                sum = sum + result[0];
            }
        }
View Full Code Here

TOP

Related Classes of org.geotools.coverage.grid.GridCoordinates2D

Copyright © 2018 www.massapicom. 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.