Package org.geotools.gce.imagemosaic.properties

Examples of org.geotools.gce.imagemosaic.properties.PropertiesCollector.collect()


        featureTypeBuilder.setName("runtimeT");
        featureTypeBuilder.add("updated", Date.class);
        SimpleFeatureType featureType = featureTypeBuilder.buildFeatureType();
        SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(featureType);
        SimpleFeature feature = featureBuilder.buildFeature("0");
        collector.collect(file);
        collector.setProperties(feature);
        Date date = (Date) feature.getAttribute("updated");
        assertEquals(lastModified, date.getTime());
    }
View Full Code Here


                final Iterator<PropertiesCollectorSPI> iterator = spis.iterator();
                while (iterator.hasNext()){
                    spi = iterator.next();
                    if (spi instanceof StringFileNameExtractorSPI){
                        final PropertiesCollector pc = spi.create(testUrl, Arrays.asList("string_attr"));
                        pc.collect(TestData.file(this,"time_geotiff/world.200402.3x5400x2700.tiff"));
                        return;
                    }
                }
               
                assertTrue(false);
View Full Code Here

    final Iterator<PropertiesCollectorSPI> iterator = spis.iterator();
    while (iterator.hasNext()){
        spi = iterator.next();
        if (spi instanceof TimestampFileNameExtractorSPI){
            final PropertiesCollector pc = spi.create(testUrl, Arrays.asList("time_attr"));
                  pc.collect(TestData.file(this,"time_geotiff/world.200403.3x5400x2700.tiff"));
                  return;
        }
    }
    assertTrue(false);
  }
View Full Code Here

    @Test
    public void testParseIsoTimestamp() {
        PropertiesCollectorSPI spi = getTimestampSpi();
        PropertiesCollector collector = spi.create("regex=[0-9]{8}T[0-9]{6}", Arrays.asList("time"));
        File file = new File("polyphemus_20130301T000000.nc");
        collector.collect(file);
        collector.setProperties(feature);
        Date time = (Date) feature.getAttribute("time");
        assertNotNull(time);
        assertEquals("2013-03-01T00:00:00.000Z", df.format(time));
View Full Code Here

        // will throw an illegalArgumentException while parsing
        File file = new File("polyphemus_20130301T00000.nc");

        boolean parsed = true;
        try {
            collector.collect(file);
            collector.setProperties(feature);
        } catch (IllegalArgumentException ie) {
            parsed = false;
        }
        assertFalse(parsed);
View Full Code Here

    @Test
    public void testParseCustomTimestamp() {
        PropertiesCollectorSPI spi = getTimestampSpi();
        PropertiesCollector collector = spi.create("regex=[0-9]{14},format=yyyyMMddHHmmss", Arrays.asList("time"));
        File file = new File("polyphemus_20130301000000.nc");
        collector.collect(file);
        collector.setProperties(feature);
        Date time = (Date) feature.getAttribute("time");
        assertNotNull(time);
        assertEquals("2013-03-01T00:00:00.000Z", df.format(time));
View Full Code Here

    public void testParseFullPathTimestamp() {
        PropertiesCollectorSPI spi = getTimestampSpi();
        String regex = "(?:\\\\)(\\d{8})(?:\\\\)(?:file.)(T\\d{6})(?:.txt)";
        PropertiesCollector collector = spi.create("regex=" + regex + ",fullPath=true", Arrays.asList("time"));
        File file = new File("c:\\data\\20120602\\file.T120000.txt");
        collector.collect(file);
        collector.setProperties(feature);
        Date time = (Date) feature.getAttribute("time");
        assertNotNull(time);
        assertEquals("2012-06-02T12:00:00.000Z", df.format(time));
    }
View Full Code Here

    public void testParseFullPathTimestampWithCustomFormat() {
        PropertiesCollectorSPI spi = getTimestampSpi();
        String regex = "(?:\\\\)(\\d{8})(?:\\\\)(?:file.)(t\\d{2}z)(?:.txt)";
        PropertiesCollector collector = spi.create("regex=" + regex + ",format=yyyyMMdd't'HH'z',fullPath=true", Arrays.asList("time"));
        File file = new File("c:\\data\\20120602\\file.t12z.txt");
        collector.collect(file);
        collector.setProperties(feature);
        Date time = (Date) feature.getAttribute("time");
        assertNotNull(time);
        assertEquals("2012-06-02T12:00:00.000Z", df.format(time));
    }
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.