Package org.geotools.coverage.grid.io

Examples of org.geotools.coverage.grid.io.AbstractGridFormat.accepts()


    URL statURL = TestData.url(this, (new StringBuffer(this.fileName)
        .append(".DEM").toString()));
    AbstractGridFormat format = (AbstractGridFormat) new GTopo30FormatFactory()
        .createFormat();

    if (format.accepts(statURL)) {

      /**
       *
       * STEP 1 Reading the coverage into memory in order to write it down
       * again
 
View Full Code Here


    ParameterValueGroup params = format.getWriteParameters();
    params.parameter(
        AbstractGridFormat.GEOTOOLS_WRITE_PARAMS.getName().toString())
        .setValue(wp);

    if (format.accepts(statURL)) {
      // get a reader
      final GridCoverageReader reader = format.getReader(statURL);

      // get a grid coverage
      final GridCoverage2D gc = ((GridCoverage2D) reader.read(null));
View Full Code Here

    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);

        File parentFile = pitFile.getParentFile();
        File newPitFile = new File(parentFile, "newpit");
View Full Code Here

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

    private GridCoverage2D readGc( AbstractGridFormat format, File fileToRead ) throws IOException {
        GridCoverageReader reader = format.getReader(fileToRead);
        GridCoverage2D gc = ((GridCoverage2D) reader.read(null));
View Full Code Here

    public boolean canRead(ImportData data) throws IOException {
        AbstractGridFormat gridFormat = gridFormat();
       
        File f = file(data);
        if (f != null) {
            return gridFormat.accepts(f);
        }
        return false;
    }

    @Override
View Full Code Here

        Assert.assertTrue(NetCDFUtilities.isGribAvailable());
        // Selection of the input file
        File file = TestData.file(this, "sampleGrib.grb2");
        // Check if the grib file is accepted by the NetCDF driver
        AbstractGridFormat format = new GRIBFormat();
        Assert.assertTrue(format.accepts(file));
        // Check if the netcdf reader spi object can read the input file
        ImageReaderSpi spi = new NetCDFImageReaderSpi();
        Assert.assertTrue(spi.canDecodeInput(file));
    }
   
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.