Package org.geotools.gce.grassraster.format

Examples of org.geotools.gce.grassraster.format.GrassCoverageFormatFactory


                                regionString.append("\ncols=");
                                regionString.append(cols);

                                GeneralParameterValue[] readParams = createGridGeometryGeneralParameter(cols, rows, north, south,
                                        east, west, mapEnvironment.getCoordinateReferenceSystem());
                                AbstractGridFormat format = (AbstractGridFormat) new GrassCoverageFormatFactory().createFormat();
                                AbstractGridCoverage2DReader reader = format.getReader(mapEnvironment.getCELL());
                                geodata = ((GridCoverage2D) reader.read(readParams));
                                geodata = geodata.view(ViewType.GEOPHYSICS);
                            } else {
                                MessageDialog.openInformation(shell, "WARNING", "Unable to read format");
View Full Code Here


        if (jGrassRegion == null)
            jGrassRegion = jGrassMapEnvironment.getActiveRegion();
        GeneralParameterValue[] readParams = JGrassCatalogUtilities.createGridGeometryGeneralParameter(jGrassRegion.getCols(),
                jGrassRegion.getRows(), jGrassRegion.getNorth(), jGrassRegion.getSouth(), jGrassRegion.getWest(),
                jGrassRegion.getEast(), crs);
        AbstractGridFormat format = (AbstractGridFormat) new GrassCoverageFormatFactory().createFormat();
        GridCoverageReader reader = format.getReader(jGrassMapEnvironment.getCELL());
        GridCoverage2D mapCoverage = ((GridCoverage2D) reader.read(readParams));
        return mapCoverage;
    }
View Full Code Here

    }

    public static void writeGridCoverageFromGrassraster( File mapFile, JGrassRegion writeRegion, GridCoverage2D grassCoverage )
            throws Exception {
        JGrassMapEnvironment mapEnvironment = new JGrassMapEnvironment(mapFile);
        GrassCoverageFormat format = new GrassCoverageFormatFactory().createFormat();
        GridCoverageWriter writer = format.getWriter(mapEnvironment.getCELL(), null);

        GeneralParameterValue[] readParams = null;
        if (writeRegion == null) {
            writeRegion = mapEnvironment.getActiveRegion();
View Full Code Here

            // write the map into it
            String mapName = mapFile.getName();
            mapName = FilenameUtils.getBaseName(mapName);
            JGrassMapEnvironment mapEnvironment = new JGrassMapEnvironment(mapsetFile, mapName);
            GrassCoverageFormat format = new GrassCoverageFormatFactory().createFormat();
            GrassCoverageWriter writer = format.getWriter(mapEnvironment.getCELL(), null);
            GeneralParameterValue[] readParams = null;
            writer.write(geodata, readParams);

            JGrassCatalogUtilities.addServiceToCatalog(locationPath + File.separator
View Full Code Here

                                    JGrassRegion jGrassRegion = oldMapEnvironment.getActiveRegion();
                                    GeneralParameterValue[] readParams = createGridGeometryGeneralParameter(
                                            jGrassRegion.getCols(), jGrassRegion.getRows(), jGrassRegion.getNorth(),
                                            jGrassRegion.getSouth(), jGrassRegion.getEast(), jGrassRegion.getWest(),
                                            oldMapEnvironment.getCoordinateReferenceSystem());
                                    AbstractGridFormat format = (AbstractGridFormat) new GrassCoverageFormatFactory()
                                            .createFormat();
                                    AbstractGridCoverage2DReader reader = format.getReader(oldMapEnvironment.getCELL());
                                    GridCoverage2D geodata = ((GridCoverage2D) reader.read(readParams));
                                    geodata = geodata.view(ViewType.GEOPHYSICS);

                                    File mapsetFile = oldMapEnvironment.getMAPSET();
                                    JGrassMapEnvironment newMapEnvironment = new JGrassMapEnvironment(mapsetFile, newMapName);
                                    format = new GrassCoverageFormatFactory().createFormat();
                                    GridCoverageWriter writer = format.getWriter(newMapEnvironment.getCELL(), null);
                                    writer.write(geodata, null);

                                    JGrassCatalogUtilities.addMapToCatalog(mapsetFile.getParent(), mapsetFile.getName(),
                                            newMapName, JGrassConstants.GRASSBINARYRASTERMAP);
View Full Code Here

                                    }

                                    String mapName = mapFile.getName();
                                    mapName = FilenameUtils.getBaseName(mapName);
                                    JGrassMapEnvironment mapEnvironment = new JGrassMapEnvironment(mapsetFile, mapName);
                                    GrassCoverageFormat format = new GrassCoverageFormatFactory().createFormat();
                                    GridCoverageWriter writer = format.getWriter(mapEnvironment.getCELL(), null);

                                    GeneralParameterValue[] readParams = null;
                                    writer.write(geodata, readParams);
View Full Code Here

                                    GeneralParameterValue[] readParams = createGridGeometryGeneralParameter(
                                            jGrassRegion.getCols(), jGrassRegion.getRows(), jGrassRegion.getNorth(),
                                            jGrassRegion.getSouth(), jGrassRegion.getEast(), jGrassRegion.getWest(),
                                            mapEnvironment.getCoordinateReferenceSystem());

                                    AbstractGridFormat format = (AbstractGridFormat) new GrassCoverageFormatFactory()
                                            .createFormat();
                                    GridCoverageReader reader = format.getReader(mapEnvironment.getCELL());
                                    GridCoverage2D geodata = ((GridCoverage2D) reader.read(readParams));
                                    geodata = geodata.view(ViewType.GEOPHYSICS);
View Full Code Here

        GridEnvelope2D gridEnvelope = new GridEnvelope2D(0, 0, r.getCols(), r.getRows());
        ReferencedEnvelope env = new ReferencedEnvelope(r.getWest(), r.getEast(), r.getSouth(), r.getNorth(), crs);
        readGG.setValue(new GridGeometry2D(gridEnvelope, env));
        readParams[0] = readGG;

        AbstractGridFormat format = (AbstractGridFormat) new GrassCoverageFormatFactory().createFormat();
        GridCoverageReader reader = format.getReader(file);
        GridCoverage2D gc = ((GridCoverage2D) reader.read(readParams));
        return gc;
    }
View Full Code Here

        GridEnvelope2D gridEnvelope = new GridEnvelope2D(0, 0, cols, rows);
        ReferencedEnvelope env = new ReferencedEnvelope(w, e, s, n, crs);
        readGG.setValue(new GridGeometry2D(gridEnvelope, env));
        readParams[0] = readGG;
        // do the reading
        AbstractGridFormat format = (AbstractGridFormat) new GrassCoverageFormatFactory().createFormat();
        GridCoverageReader reader = format.getReader(file);
        GridCoverage2D gc = ((GridCoverage2D) reader.read(readParams));
       
        // readgrassraster stop
        return gc;
View Full Code Here

            {600, 700, 750, 800, 780, 790, 1000, 1100, 1250, 1500},
            {800, 910, 980, 1001, 1150, 1200, 1250, 1300, 1450, 1500}};

    public void test() throws Exception {
        URL pitUrl = this.getClass().getClassLoader().getResource("testlocation/test/cell/pit");
        AbstractGridFormat format = (AbstractGridFormat) new GrassCoverageFormatFactory()
                .createFormat();
        File pitFile = DataUtilities.urlToFile(pitUrl);
        assertTrue(format.accepts(pitFile));

        GridCoverage2D gc = readGc(format, pitFile);
View Full Code Here

TOP

Related Classes of org.geotools.gce.grassraster.format.GrassCoverageFormatFactory

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.