Package org.geotools.coverage.grid.io

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


                    : upperCase.equalsIgnoreCase(Utils.ELEVATION_DOMAIN) ? CoverageUtilities.UCUM.ELEVATION_UNITS.getName() :
                        "FIXME"; //TODO: ADD UCUM units Management
            final String unitsSymbol = upperCase.equalsIgnoreCase(Utils.TIME_DOMAIN) ? CoverageUtilities.UCUM.TIME_UNITS.getSymbol()
                    : upperCase.equalsIgnoreCase(Utils.ELEVATION_DOMAIN) ? CoverageUtilities.UCUM.ELEVATION_UNITS.getSymbol() :
                        "FIXME"; //TODO: ADD UCUM units Management
            final DimensionDescriptor dimensionDescriptor = new DefaultDimensionDescriptor(name, unitsName, unitsSymbol, basePropertyName, additionalPropertyName);
            dimensions.add(dimensionDescriptor);
        }
View Full Code Here


                List<DimensionDescriptor> descriptors = ((StructuredGridCoverage2DReader)reader).getDimensionDescriptors(coverageName);
                assertNotNull(descriptors);
                assertEquals(2, descriptors.size());

                DimensionDescriptor descriptor = descriptors.get(0);
                assertEquals("TIME", descriptor.getName());
                assertEquals("time", descriptor.getStartAttribute());
                assertNull(descriptor.getEndAttribute());
                assertEquals(CoverageUtilities.UCUM.TIME_UNITS.getName(), descriptor.getUnits());
                assertEquals(CoverageUtilities.UCUM.TIME_UNITS.getSymbol(), descriptor.getUnitSymbol());

                descriptor = descriptors.get(1);
                assertEquals("ELEVATION", descriptor.getName());
                assertEquals("z", descriptor.getStartAttribute());
                assertNull(descriptor.getEndAttribute());
                assertEquals("meters", descriptor.getUnits());
                assertEquals(CoverageUtilities.UCUM.ELEVATION_UNITS.getSymbol(), descriptor.getUnitSymbol());

                // subsetting the envelope
                final ParameterValue<GridGeometry2D> gg = AbstractGridFormat.READ_GRIDGEOMETRY2D
                        .createValue();
                final GeneralEnvelope originalEnvelope = reader.getOriginalEnvelope(coverageName);
View Full Code Here

            final List<DimensionDescriptor> dimensions = cd.getDimensionDescriptors();
            assertNotNull(dimensions);
            assertTrue(!dimensions.isEmpty());
            assertEquals("wrong dimensions", 2, dimensions.size());
            DimensionDescriptor dim = dimensions.get(0);
            assertTrue(dim.getName().equals("TIME"));
            assertTrue(dim.getStartAttribute().equals("time"));
            dim = dimensions.get(1);
            assertTrue(dim.getName().equals("ELEVATION"));
            assertTrue(dim.getStartAttribute().equals("z"));

            // check coverage names
            final List<Name> names = reader.getCoveragesNames();
            assertNotNull(names);
            assertTrue(!names.isEmpty());
View Full Code Here

            // Parsing metadata values
            assertEquals("true", reader.getMetadataValue(names[0], "HAS_TIME_DOMAIN"));

            List<DimensionDescriptor> descriptors = reader.getDimensionDescriptors(names[0]);
            assertEquals(1, descriptors.size());
            DimensionDescriptor descriptor = descriptors.get(0);
            assertEquals("time", descriptor.getStartAttribute());
            assertEquals("TIME", descriptor.getName());

            descriptors = reader.getDimensionDescriptors(names[1]);
            assertEquals(1, descriptors.size());
            descriptor = descriptors.get(0);
            assertEquals("time1", descriptor.getStartAttribute());
            assertEquals("TIME", descriptor.getName());

            assertEquals("true", reader.getMetadataValue(names[1], "HAS_TIME_DOMAIN"));

        } finally {
            if (reader != null) {
View Full Code Here

        Map<String, DimensionDescriptor> dds = new HashMap<String, DimensionDescriptor>();
        for (DimensionDescriptor dd : descriptors) {
            dds.put(dd.getName(), dd);
        }

        DimensionDescriptor descriptor = dds.get("wavelength");
        assertEquals("wavelength", descriptor.getName());
        assertEquals("loww", descriptor.getStartAttribute());
        assertEquals("highw", descriptor.getEndAttribute());

        descriptor = dds.get("date");
        assertEquals("date", descriptor.getName());
        assertEquals("date", descriptor.getStartAttribute());
        assertNull(descriptor.getEndAttribute());

        descriptor = dds.get("TIME");
        assertEquals("TIME", descriptor.getName());
        assertEquals("time", descriptor.getStartAttribute());
        assertEquals("endtime", descriptor.getEndAttribute());
        assertEquals(CoverageUtilities.UCUM.TIME_UNITS.getName(), descriptor.getUnits());
        assertEquals(CoverageUtilities.UCUM.TIME_UNITS.getSymbol(), descriptor.getUnitSymbol());
       
        descriptor = dds.get("ELEVATION");
        assertEquals("ELEVATION", descriptor.getName());
        assertEquals("lowz", descriptor.getStartAttribute());
        assertEquals("highz", descriptor.getEndAttribute());
       
    }
View Full Code Here

                    if(di.isEnabled()) {
                        String dimensionName = entry.getKey();
                        if(dimensionName.startsWith(ResourceInfo.CUSTOM_DIMENSION_PREFIX)) {
                            dimensionName = dimensionName.substring(ResourceInfo.CUSTOM_DIMENSION_PREFIX.length());
                        }
                        DimensionDescriptor selected = sourceDescriptors.get(dimensionName.toUpperCase());
                        if(selected != null) {
                            enabledDescriptors.add(selected);
                        }
                    }
                }
View Full Code Here

                }
            }

            // temporal subset
            if (timeRange != null && filter != Filter.EXCLUDE) {
                DimensionDescriptor timeDescriptor = WCSDimensionsHelper.getDimensionDescriptor(reader, coverageName, "TIME");
                String start = timeDescriptor.getStartAttribute();
                String end = timeDescriptor.getEndAttribute();
               
                Filter timeFilter;
                if(end == null) {
                    // single value time
                    timeFilter = ff.between(ff.property(start), ff.literal(timeRange.getMinValue()), ff.literal(timeRange.getMaxValue()));
View Full Code Here

    }

    public String getMetadataValue(String name) throws IOException {
        if(name.endsWith("_DOMAIN_MINIMUM") || name.endsWith("_DOMAIN_MAXIMUM") || name.endsWith("_DOMAIN")) {
            String dimensionName = name.substring(0, name.indexOf("_DOMAIN"));
            DimensionDescriptor descriptor = dimensionDescriptors.get(dimensionName);
            if(descriptor != null) {
                Object start = feature.getAttribute(descriptor.getStartAttribute());
                Object end = null;
                if(descriptor.getEndAttribute() != null) {
                    end = feature.getAttribute(descriptor.getEndAttribute());
                }
                if(dimensionName.equalsIgnoreCase("TIME")) {
                    start = formatter.format((Date) start);
                    if(end != null) {
                        end = formatter.format((Date) end);
View Full Code Here

        // Casting to StructuredGridCoverage2DReader
        final StructuredGridCoverage2DReader structuredReader = (StructuredGridCoverage2DReader) reader;

        // Getting dimension descriptors
        final List<DimensionDescriptor> dimensionDescriptors = structuredReader.getDimensionDescriptors(coverageName);
        DimensionDescriptor timeDimension = null;
        DimensionDescriptor elevationDimension = null;
        final List<DimensionDescriptor> customDimensions = new ArrayList<DimensionDescriptor>();
        int dimensions = 0;

        // Collect dimension Descriptor info
        for (DimensionDescriptor dimensionDescriptor: dimensionDescriptors) {
View Full Code Here

        for (Map.Entry<String, Object> entry : restrictions.entrySet()) {
            String name = entry.getKey();
            Object value = entry.getValue();
            List<Object> values = wrapIntoList(value);

            DimensionDescriptor descriptor = descriptors.get(name);
            if (descriptor == null) {
                throw new ServiceException("Could not find dimension " + name
                        + " in coverage reader backing " + resource.prefixedName());
            }

            builder.appendFilters(descriptor.getStartAttribute(), descriptor.getEndAttribute(),
                    values);
        }
        Filter domainRestriction = builder.getFilter();

        // get the restricted domain
        GranuleSource granules = reader.getGranules(coverageName, true);
        Query q = new Query(granules.getSchema().getTypeName(), domainRestriction);
        SimpleFeatureCollection fc = granules.getGranules(q);

        DimensionDescriptor dd = descriptors.get(dimensionName);
        if (dd == null) {
            throw new ServiceException("Could not find dimension " + dimensionName
                    + " in coverage reader backing " + resource.prefixedName());
        }
        FeatureCalc calc = getFeatureCalcForStrategy(delegateStrategy, dd);
View Full Code Here

TOP

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

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.