Package org.geotools.gce.imagemosaic

Examples of org.geotools.gce.imagemosaic.ImageMosaicFormat


        // the datastore.properties file is also mandatory...
        File dsp = TestData.file(this,"datastore.properties");
        FileUtils.copyFileToDirectory(dsp, mosaic);
       
        // have the reader harvest it
        ImageMosaicFormat format = new ImageMosaicFormat();
        ImageMosaicReader reader = format.getReader(mosaic);
        SimpleFeatureIterator it = null;
        assertNotNull(reader);
        try {
            String[] names = reader.getGridCoverageNames();
            assertEquals(1, names.length);
View Full Code Here


        // the datastore.properties file is also mandatory...
        File dsp =TestData.file(this,"datastore.properties");
        FileUtils.copyFileToDirectory(dsp, mosaic);
       
        // have the reader harvest it
        ImageMosaicFormat format = new ImageMosaicFormat();
        ImageMosaicReader reader = format.getReader(mosaic);
        SimpleFeatureIterator it = null;
        assertNotNull(reader);
        try {
            String[] names = reader.getGridCoverageNames();
            assertEquals(1, names.length);
            assertEquals("O3", names[0]);
           
            // check we have the two granules we expect
            GranuleSource source = reader.getGranules("O3", true);
            FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
            Query q = new Query(Query.ALL);
            q.setSortBy(new SortBy[] {ff.sort("time", SortOrder.ASCENDING)});
            SimpleFeatureCollection granules = source.getGranules(q);
            assertEquals(2, granules.size());
            it = granules.features();
            assertTrue(it.hasNext());
            SimpleFeature f = it.next();
            assertEquals("polyphemus_20130301_test.nc", f.getAttribute("location"));
            assertEquals(0, f.getAttribute("imageindex"));
            assertEquals("2013-03-01T00:00:00.000Z", ConvertersHack.convert(f.getAttribute("time"), String.class));
            assertTrue(it.hasNext());
            f = it.next();
            assertEquals("polyphemus_20130301_test.nc", f.getAttribute("location"));
            assertEquals(1, f.getAttribute("imageindex"));
            assertEquals("2013-03-01T01:00:00.000Z", ConvertersHack.convert(f.getAttribute("time"), String.class));
            it.close();
           
            // close the reader and re-open it
            reader.dispose();
            reader = format.getReader(mosaic);
            source = reader.getGranules("O3", true);
           
            // wait a bit, we have to make sure the old indexes are recognized as old
            Thread.sleep(1000);
           
View Full Code Here

              //  + "PropertyCollectors=TimestampFileNameExtractorSPI[timeregex](time)\n";
        indexer += Prop.AUXILIARY_FILE + "=" + "hdf5Coverage2D.xml";
        FileUtils.writeStringToFile(new File(mosaic, "indexer.properties"), indexer);

        //simply test if the mosaic can be read without exceptions
        ImageMosaicFormat format = new ImageMosaicFormat();
        ImageMosaicReader reader = format.getReader(mosaic);
        reader.read("L1_V2",null);
    }
View Full Code Here

        // the datastore.properties file is also mandatory...
        File dsp = TestData.file(this,"datastore.properties");
        FileUtils.copyFileToDirectory(dsp, mosaic);
       
        // have the reader harvest it
        ImageMosaicFormat format = new ImageMosaicFormat();
        ImageMosaicReader reader = format.getReader(mosaic);
        SimpleFeatureIterator it = null;
        assertNotNull(reader);
        try {
            String[] names = reader.getGridCoverageNames();
            assertEquals(1, names.length);
View Full Code Here

        // the datastore.properties file is also mandatory...
        File dsp = TestData.file(this, "datastore.properties");
        FileUtils.copyFileToDirectory(dsp, mosaic);

        // have the reader harvest it
        ImageMosaicFormat format = new ImageMosaicFormat();
        ImageMosaicReader reader = format.getReader(mosaic);
        SimpleFeatureIterator it = null;
        assertNotNull(reader);
        try {
            // use imageio with defined tiles
            final ParameterValue<Boolean> useJai = AbstractGridFormat.USE_JAI_IMAGEREAD
View Full Code Here

        // the datastore.properties file is also mandatory...
        File dsp = TestData.file(this,"datastore.properties");
        FileUtils.copyFileToDirectory(dsp, mosaic);

        // have the reader harvest it
        ImageMosaicFormat format = new ImageMosaicFormat();
        ImageMosaicReader reader = format.getReader(mosaic);
        SimpleFeatureIterator it = null;
        assertNotNull(reader);
        try {
            String[] names = reader.getGridCoverageNames();
            assertEquals(1, names.length);
View Full Code Here

        // the datastore.properties file is also mandatory...
        File dsp = TestData.file(this,"datastore.properties");
        FileUtils.copyFileToDirectory(dsp, mosaic);

        // have the reader harvest it
        ImageMosaicFormat format = new ImageMosaicFormat();
        ImageMosaicReader reader = format.getReader(mosaic);
        GridCoverage2D coverage = null;
        assertNotNull(reader);
        try {
            String[] names = reader.getGridCoverageNames();
            assertEquals(1, names.length);
            assertEquals("NO2", names[0]);
           
            GranuleSource source = reader.getGranules("NO2", true);
            SimpleFeatureCollection granules = source.getGranules(Query.ALL);
            assertEquals(1, granules.size());
           
            assertTrue(CRS.equalsIgnoreMetadata(DefaultGeographicCRS.WGS84, reader.getCoordinateReferenceSystem()));
            GeneralEnvelope envelope = reader.getOriginalEnvelope("NO2");
            assertEquals(-360, envelope.getMinimum(0), 0d);
            assertEquals(360, envelope.getMaximum(0), 0d);
            assertEquals(-180, envelope.getMinimum(1), 0d);
            assertEquals(180, envelope.getMaximum(1), 0d);

            // check we can read a coverage out of it
            coverage = reader.read(null);
            reader.dispose();

            // Checking we can read again from the coverage once it has been configured.
            reader = format.getReader(mosaic);
            coverage = reader.read(null);
            assertNotNull(coverage);
           
        } finally {
            if(coverage != null) {
View Full Code Here

        // the datastore.properties file is also mandatory...
        File dsp = TestData.file(this, "datastore.properties");
        FileUtils.copyFileToDirectory(dsp, mosaic);

        // have the reader harvest it
        ImageMosaicFormat format = new ImageMosaicFormat();
        ImageMosaicReader reader = format.getReader(mosaic);
        InputStream inStream = null;
        assertNotNull(reader);
        try {
            String[] names = reader.getGridCoverageNames();
            assertEquals(1, names.length);
View Full Code Here

        // the datastore.properties file is also mandatory...
        File dsp = TestData.file(this,"datastore.properties");
        FileUtils.copyFileToDirectory(dsp, mosaic);

        // have the reader harvest it
        ImageMosaicFormat format = new ImageMosaicFormat();
        ImageMosaicReader reader = format.getReader(mosaic);
        GridCoverage2D coverage = null;
        assertNotNull(reader);
        try {
            assertEquals(2, reader.getGridCoverageNames().length);

            File[] files = mosaic.listFiles();
            assertEquals(15, files.length);
           
            reader.dispose();
            reader = format.getReader(mosaic);
           
            reader.delete(false);
            files = mosaic.listFiles();
            assertEquals(1, files.length);
           
View Full Code Here

        // the datastore.properties file is also mandatory...
        File dsp = TestData.file(this,"datastore.properties");
        FileUtils.copyFileToDirectory(dsp, mosaic);

        // have the reader harvest it
        ImageMosaicFormat format = new ImageMosaicFormat();
        ImageMosaicReader reader = format.getReader(mosaic);
        GridCoverage2D coverage = null;
        assertNotNull(reader);
        try {
            String[] names = reader.getGridCoverageNames();
            assertEquals(2, names.length);
            assertEquals("NO2", names[0]);
            assertEquals("BrO", names[1]);
           
            GranuleSource source = reader.getGranules("NO2", true);
            SimpleFeatureCollection granules = source.getGranules(Query.ALL);
            assertEquals(1, granules.size());
           
            assertTrue(CRS.equalsIgnoreMetadata(DefaultGeographicCRS.WGS84, reader.getCoordinateReferenceSystem("NO2")));
            GeneralEnvelope envelope = reader.getOriginalEnvelope("NO2");
            assertEquals(-360, envelope.getMinimum(0), 0d);
            assertEquals(360, envelope.getMaximum(0), 0d);
            assertEquals(-180, envelope.getMinimum(1), 0d);
            assertEquals(180, envelope.getMaximum(1), 0d);

            // check we can read a coverage out of it
            coverage = reader.read("NO2", null);
            reader.dispose();

            // Checking we can read again from the coverage (using a different name this time) once it has been configured.
            reader = format.getReader(mosaic);
            coverage = reader.read("BrO", null);
            assertNotNull(coverage);
           
        } finally {
            if(coverage != null) {
View Full Code Here

TOP

Related Classes of org.geotools.gce.imagemosaic.ImageMosaicFormat

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.