Examples of JGrassRegion


Examples of org.geotools.gce.grassraster.JGrassRegion

             */
            double minY = srcRegion.getMinY();
            double newNorth = nativeRasterRegion.getNorth() - minY * yRes;
            double newSouth = newNorth - srcRegion.height * yRes;

            activeReadRegion = new JGrassRegion(newWest, newEast, newSouth, newNorth,
                    intRealRowsToRead, intRealColsToRead);
            int colsAtMaxRes = activeReadRegion.getCols();
            int rowsAtMaxRes = activeReadRegion.getRows();

            if (!useSubSamplingAsRequestedRowcols) {
                rasterMapWidth = colsAtMaxRes / sourceXSubsampling;
                rasterMapHeight = rowsAtMaxRes / sourceYSubsampling;
            } else {
                rasterMapWidth = sourceXSubsampling;
                rasterMapHeight = sourceYSubsampling;
            }
            activeReadRegion.setCols(rasterMapWidth);
            activeReadRegion.setRows(rasterMapHeight);

        } else {
            // the whole image is read
            activeReadRegion = new JGrassRegion(nativeRasterRegion);
            rasterMapWidth = nativeRasterRegion.getCols();
            rasterMapHeight = nativeRasterRegion.getRows();
        }

        /*
 
View Full Code Here

Examples of org.geotools.gce.grassraster.JGrassRegion

            /*
             * Setup file window object that holds the geographic limits of the
             * file data.
             */
            if (readerFileHeaderMap.containsKey("n-s res")) {
                nativeRasterRegion = new JGrassRegion(Double.parseDouble(readerFileHeaderMap
                        .get("west")), Double.parseDouble(readerFileHeaderMap.get("east")), Double
                        .parseDouble(readerFileHeaderMap.get("south")), Double
                        .parseDouble(readerFileHeaderMap.get("north")), Double
                        .parseDouble(readerFileHeaderMap.get("e-w res")), Double
                        .parseDouble(readerFileHeaderMap.get("n-s res")));
            } else if (readerFileHeaderMap.containsKey("cols")) {
                nativeRasterRegion = new JGrassRegion(Double.parseDouble(readerFileHeaderMap
                        .get("west")), Double.parseDouble(readerFileHeaderMap.get("east")), Double
                        .parseDouble(readerFileHeaderMap.get("south")), Double
                        .parseDouble(readerFileHeaderMap.get("north")), Integer
                        .parseInt(readerFileHeaderMap.get("rows")), Integer
                        .parseInt(readerFileHeaderMap.get("cols")));
View Full Code Here

Examples of org.geotools.gce.grassraster.JGrassRegion

        imageNullFileOS = ImageIO.createImageOutputStream(writerGrassEnv.getCELLMISC_NULL());

        double east = west + ((double) columns) * xRes;
        double north = south + ((double) rows) * yRes;

        JGrassRegion dataWindow = new JGrassRegion(west, east, south, north, rows, columns);

        createEmptyHeader(rows);

        if (hasListeners && abortRequired) {
            return;
View Full Code Here

Examples of org.geotools.gce.grassraster.JGrassRegion

     * @throws IOException
     */
    public JGrassRegion getWriteRegion() throws IOException {
        if (writeRegion == null) {
            File wind = writerGrassEnv.getWIND();
            writeRegion = new JGrassRegion(wind.getAbsolutePath());
        }
        return writeRegion;
    }
View Full Code Here

Examples of org.geotools.gce.grassraster.JGrassRegion

        /*
         * need to reread the wind file to get the proj and zone (GRASS will not work if the cellhd
         * is not equal to the WIND proj)
         */

        JGrassRegion tmp = getWriteRegion();
        createCellhd(tmp.getProj(), tmp.getZone(), dataRegion.getNorth(), dataRegion.getSouth(),
                dataRegion.getEast(), dataRegion.getWest(), dataRegion.getCols(), dataRegion
                        .getRows(), dataRegion.getNSResolution(), dataRegion.getWEResolution(), -1,
                1);

        // hist/<name>
View Full Code Here

Examples of org.geotools.gce.grassraster.JGrassRegion

    private static final double EPSI = 0.0001;

    public void testJGrassMapEnvironment() throws IOException {
        URL theUrl = this.getClass().getClassLoader().getResource("exampleWIND1");
        File regionFile = DataUtilities.urlToFile(theUrl);
        JGrassRegion tmpRegion = new JGrassRegion(regionFile.getAbsolutePath());
        assertEquals(tmpRegion.getNorth(), 5052484.11852058);
        assertEquals(tmpRegion.getSouth(), 5041259.917339253);
        assertEquals(tmpRegion.getEast(), 679785.979783096);
        assertEquals(tmpRegion.getWest(), 668296.4273310362);
        assertEquals(tmpRegion.getNSResolution(), 4.999644178764807);
        assertEquals(tmpRegion.getWEResolution(), 4.999805244586515);
        assertEquals(tmpRegion.getRows(), 2245);
        assertEquals(tmpRegion.getCols(), 2298);

        theUrl = this.getClass().getClassLoader().getResource("exampleWINDLatLong");
        regionFile = DataUtilities.urlToFile(theUrl);
        tmpRegion = new JGrassRegion(regionFile.getAbsolutePath());
        assertEquals(tmpRegion.getNorth(), -3.742082752222222);
        assertEquals(tmpRegion.getSouth(), -3.9554160855555556);
        assertEquals(tmpRegion.getEast(), 30.15125023476092);
        assertEquals(tmpRegion.getWest(), 29.840416916475846);
        assertEquals(tmpRegion.getNSResolution(), 8.333333333333335E-4);
        assertEquals(tmpRegion.getWEResolution(), 8.333332929894733E-4);
        assertEquals(tmpRegion.getRows(), 256);
        assertEquals(tmpRegion.getCols(), 373);

        theUrl = this.getClass().getClassLoader().getResource("exampleCELLHD1");
        File cellhdFile = DataUtilities.urlToFile(theUrl);
        tmpRegion = new JGrassRegion(cellhdFile.getAbsolutePath());
        assertEquals(tmpRegion.getNorth(), 5052484.11852058);
        assertEquals(tmpRegion.getSouth(), 5041259.917339253);
        assertEquals(tmpRegion.getEast(), 679785.979783096);
        assertEquals(tmpRegion.getWest(), 668296.4273310362);
        assertEquals(tmpRegion.getNSResolution(), 4.999644178764807);
        assertEquals(tmpRegion.getWEResolution(), 4.999805244586515);
        assertEquals(tmpRegion.getRows(), 2245);
        assertEquals(tmpRegion.getCols(), 2298);

        theUrl = this.getClass().getClassLoader().getResource("exampleCELLHDLatLong");
        cellhdFile = DataUtilities.urlToFile(theUrl);
        tmpRegion = new JGrassRegion(cellhdFile.getAbsolutePath());
        assertTrue(tmpRegion.getNorth() - 0.0004 < EPSI);
        assertTrue(tmpRegion.getSouth() - (-5.0004) < EPSI);
        assertTrue(tmpRegion.getEast() - 35.0004 < EPSI);
        assertTrue(tmpRegion.getWest() - 25 < EPSI);
        assertTrue(tmpRegion.getNSResolution() - 8.333333333333334E-4 < EPSI);
        assertTrue(tmpRegion.getWEResolution() - 8.333332929894731E-4 < EPSI);
        assertEquals(tmpRegion.getRows(), 6001);
        assertEquals(tmpRegion.getCols(), 12001);

    }
View Full Code Here

Examples of org.geotools.gce.grassraster.JGrassRegion

     *
     * @param rasterReader the {@linkplain GrassBinaryRasterReadHandler} used to initialize fields.
     */
    private void inizializeFromRaster( GrassBinaryRasterReadHandler rasterReader ) {
        if (rasterReader != null) {
            JGrassRegion nativeRasterRegion = rasterReader.getNativeRasterRegion();
            nRows = nativeRasterRegion.getRows();
            nCols = nativeRasterRegion.getCols();
            xRes = nativeRasterRegion.getWEResolution();
            yRes = nativeRasterRegion.getNSResolution();
            north = nativeRasterRegion.getNorth();
            south = nativeRasterRegion.getSouth();
            east = nativeRasterRegion.getEast();
            west = nativeRasterRegion.getWest();
            noData = rasterReader.getNoData();
            try {
                colorRulesString = rasterReader.getColorRules(null);
                categoriesString = rasterReader.getCategories();
                crs = rasterReader.getCrs();
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.