Package org.geotools.coverage.grid.io

Examples of org.geotools.coverage.grid.io.AbstractGridFormat


        final URL timeElevURL = DataUtilities.fileToURL(workDir);
//


        // now start the test
        AbstractGridFormat format = TestUtils.getFormat(timeElevURL);
        assertNotNull(format);
        ImageMosaicReader reader = TestUtils.getReader(timeElevURL, format);
        assertNotNull(reader);

        reader.dispose();
View Full Code Here


    @Test
    public void testPAMAuxiliaryFiles() throws Exception {
        final URL timePamURL = TestData.url(this, "pam");

        final AbstractGridFormat format = TestUtils.getFormat(timePamURL);
        assertNotNull(format);
        ImageMosaicReader reader = TestUtils.getReader(timePamURL, format);
        assertNotNull(format);

        final String[] metadataNames = reader.getMetadataNames();
View Full Code Here

    @Test
    public void testPAMMerged() throws Exception {
        final URL timePamURL = TestData.url(this, "pam");

        final AbstractGridFormat format = TestUtils.getFormat(timePamURL);
        assertNotNull(format);
        ImageMosaicReader reader = TestUtils.getReader(timePamURL, format);
        assertNotNull(format);

        final String[] metadataNames = reader.getMetadataNames();
View Full Code Here

        //
        // no crs geotiff
        //
        final File noCrs = TestData.file(GeoTiffReaderTest.class, "no_crs.tif");
        final AbstractGridFormat format = new GeoTiffFormat();
        assertTrue(format.accepts(noCrs));
        GeoTiffReader reader = (GeoTiffReader) format.getReader(noCrs);
        CoordinateReferenceSystem crs=reader.getCrs();
        assertTrue(CRS.equalsIgnoreMetadata(crs, DefaultEngineeringCRS.GENERIC_2D));
        GridCoverage2D coverage=reader.read(null);
        assertTrue(CRS.equalsIgnoreMetadata(coverage.getCoordinateReferenceSystem(), DefaultEngineeringCRS.GENERIC_2D));
       

        // hint for CRS
        crs = CRS.decode("EPSG:32632", true);
        final Hints hint = new Hints();
        hint.put(Hints.DEFAULT_COORDINATE_REFERENCE_SYSTEM, crs);

        // getting a reader
        reader = new GeoTiffReader(noCrs, hint);

        // reading the coverage
        GridCoverage2D coverage1 = (GridCoverage2D) reader.read(null);

        // check coverage and crs
        assertNotNull(coverage1);
        assertNotNull(coverage1.getCoordinateReferenceSystem());
        assertEquals(CRS.lookupIdentifier(coverage1.getCoordinateReferenceSystem(), true),
                "EPSG:32632");
        reader.dispose();

        //
        // use prj and wld
        //
        final File wldprjFile = TestData.file(GeoTiffReaderTest.class, "no_crs_no_envelope.tif");
        assertTrue(format.accepts(wldprjFile));

        // getting a reader
        reader = new GeoTiffReader(wldprjFile);

        // reading the coverage
        GridCoverage2D coverage2 = (GridCoverage2D) reader.read(null);

        // check coverage and crs
        assertNotNull(coverage2);
        assertNotNull(coverage2.getCoordinateReferenceSystem());
        assertEquals(CRS.lookupIdentifier(coverage2.getCoordinateReferenceSystem(), true),
                "EPSG:32632");
        reader.dispose();

        //
        // use prj and hint
        //
        final File wldFile = TestData.file(GeoTiffReaderTest.class, "no_crs_no_envelope2.tif");
        assertTrue(format.accepts(wldFile));

        // getting a reader
        reader = new GeoTiffReader(wldFile, hint);

        // reading the coverage
View Full Code Here

        //
        // no crs geotiff
        //
        final File sampleFile = TestData.file(GeoTiffReaderTest.class, "geo.tiff");
        final AbstractGridFormat format = new GeoTiffFormat();
        assertTrue(format.accepts(sampleFile));
        GeoTiffReader reader = (GeoTiffReader) format.getReader(sampleFile);
        ParameterValue<Boolean> useJai = AbstractGridFormat.USE_JAI_IMAGEREAD.createValue();
        useJai.setValue(false);
       
        ParameterValue<OverviewPolicy> op = AbstractGridFormat.OVERVIEW_POLICY.createValue();
        op.setValue(OverviewPolicy.NEAREST);
View Full Code Here

            NoSuchAuthorityCodeException {

        final File file = TestData.file(this, ".");
        final File files[] = file.listFiles();
        final int numFiles = files.length;
        final AbstractGridFormat format = new GeoTiffFormat();
        for (int i = 0; i < numFiles; i++) {
        StringBuilder buffer = new StringBuilder();
            final String path = files[i].getAbsolutePath().toLowerCase();
        if (!path.endsWith("tif") && !path.endsWith("tiff")||path.contains("no_crs"))
                continue;
            if (path.contains("ovr.tif"))
                continue;
            buffer.append(files[i].getAbsolutePath()).append("\n");
            Object o;
            if (i % 2 == 0)
                // testing file
                o = files[i];
            else
                // testing url
                o = files[i].toURI().toURL();
            if (format.accepts(o)) {
                buffer.append("ACCEPTED").append("\n");

                // getting a reader
                GeoTiffReader reader = new GeoTiffReader(o, new Hints(
                        Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE));
View Full Code Here

   * @throws FactoryException
   */
  @Test
//  @Ignore
  public void overviews() throws Exception {
    final AbstractGridFormat format = TestUtils.getFormat(overviewURL);
    final ImageMosaicReader reader = TestUtils.getReader(overviewURL, format);

    // limit yourself to reading just a bit of it
    final ParameterValue<GridGeometry2D> gg =  AbstractGridFormat.READ_GRIDGEOMETRY2D.createValue();
    final GeneralEnvelope envelope = reader.getOriginalEnvelope();
View Full Code Here

     * @throws FactoryException
     */
    @Test
    // @Ignore
    public void readingResolutions() throws Exception {
        final AbstractGridFormat format = TestUtils.getFormat(overviewURL);
        final ImageMosaicReader reader = TestUtils.getReader(overviewURL, format);
        double[] result = reader.getReadingResolutions(OverviewPolicy.QUALITY, new double[] { 32, 32 });
        assertEquals(16.0714285714285, result[0], DELTA);
        assertEquals(16.0427807486631, result[1], DELTA);
    }
View Full Code Here

        }
      }
     
     
      // now start the test
    final AbstractGridFormat format = TestUtils.getFormat(timeElevURL);
    assertNotNull(format);
    ImageMosaicReader reader = TestUtils.getReader(timeElevURL, format);
    assertNotNull(reader);
   
    final String[] metadataNames = reader.getMetadataNames();
View Full Code Here

                IOUtils.closeQuietly(out);
            }
        }

        // now start the test
        AbstractGridFormat format = TestUtils.getFormat(timeElevURL);
        assertNotNull(format);
        ImageMosaicReader reader = TestUtils.getReader(timeElevURL, format);
        assertNotNull(reader);
        reader.dispose();
        format=null;
View Full Code Here

TOP

Related Classes of org.geotools.coverage.grid.io.AbstractGridFormat

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.