public CoverageDimensionImpl(CoverageDimensionInfo other) { this.id = other.getId(); this.name = other.getName(); this.description = other.getDescription(); this.range = other.getRange(); this.nullValues = other.getNullValues(); this.unit = other.getUnit(); this.dimensionType = other.getDimensionType(); }
@Test public void testPreserveCoverageBandNames() throws Exception { final Catalog cat = getCatalog(); final CoverageStoreInfo storeInfo = cat.getCoverageStoreByName("ir-rgb"); final CoverageView coverageView = buildRgbIRView(); final CatalogBuilder builder = new CatalogBuilder(cat); builder.setStore(storeInfo); final CoverageInfo coverageInfo = coverageView.createCoverageInfo(RGB_IR_VIEW, storeInfo, builder); List<CoverageDimensionInfo> dimensions = coverageInfo.getDimensions(); assertEquals("rband", dimensions.get(0).getName()); assertEquals("gband", dimensions.get(1).getName()); assertEquals("bband", dimensions.get(2).getName()); assertEquals("irband", dimensions.get(3).getName()); }
public static WrappedSampleDimension build( GridSampleDimension sampleDim, CoverageDimensionInfo info) { String name = info.getName(); final InternationalString sampleDimDescription = sampleDim.getDescription(); InternationalString configuredDescription =
@Test public void testSingleBandedCoverage() throws Exception { // build a feature type (it's already in the catalog, but we just want to // check it's built as expected // LINES is a feature type with a native SRS, so we want the bounds to be there Catalog cat = getCatalog(); CatalogBuilder cb = new CatalogBuilder(cat); cb.setStore(cat.getCoverageStoreByName(MockData.TASMANIA_DEM.getLocalPart())); CoverageInfo ci = cb.buildCoverage(); // perform basic checks assertEquals(CRS.decode("EPSG:4326", true), ci.getCRS()); assertEquals("EPSG:4326", ci.getSRS()); assertNotNull(ci.getNativeCRS()); assertNotNull(ci.getNativeBoundingBox()); assertNotNull(ci.getLatLonBoundingBox()); // check the coverage dimensions List<CoverageDimensionInfo> dimensions = ci.getDimensions(); assertEquals(1, dimensions.size()); CoverageDimensionInfo dimension = dimensions.get(0); assertEquals("GRAY_INDEX", dimension.getName()); assertEquals(1, dimension.getNullValues().size()); assertEquals(-9999, dimension.getNullValues().get(0), 0d); assertEquals(Double.NEGATIVE_INFINITY, dimension.getRange().getMinimum(), 0d); // Huston, we have a problem here... // assertEquals(9999, dimension.getRange().getMaximum(), 0d); assertNull(dimension.getUnit()); }
@Test public void testMultiBandCoverage() throws Exception { Catalog cat = getCatalog(); CatalogBuilder cb = new CatalogBuilder(cat); cb.setStore(cat.getCoverageStoreByName(MockData.TASMANIA_BM.getLocalPart())); CoverageInfo ci = cb.buildCoverage(); // perform basic checks assertEquals(CRS.decode("EPSG:4326", true), ci.getCRS()); assertEquals("EPSG:4326", ci.getSRS()); assertNotNull(ci.getNativeCRS()); assertNotNull(ci.getNativeBoundingBox()); assertNotNull(ci.getLatLonBoundingBox()); // check the coverage dimensions List<CoverageDimensionInfo> dimensions = ci.getDimensions(); assertEquals(3, dimensions.size()); CoverageDimensionInfo dimension = dimensions.get(0); assertEquals("RED_BAND", dimension.getName()); assertEquals(0, dimension.getNullValues().size()); assertEquals(Double.NEGATIVE_INFINITY, dimension.getRange().getMinimum(), 0d); assertEquals(Double.POSITIVE_INFINITY, dimension.getRange().getMaximum(), 0d); assertEquals("W.m-2.Sr-1", dimension.getUnit()); }
Level.INFO, "Failed to guess the size of dimension " + dimension.getName() + ", skipping the pre-read check"); pixelSize = -1;
protected void handleAxis(CoverageInfo ci) { final AttributesImpl attributes = new AttributesImpl(); attributes.addAttribute("", "identifier", "identifier", "", "Bands"); start("wcs:Axis", attributes); start("wcs:AvailableKeys"); List<CoverageDimensionInfo> dimensions = ci.getDimensions(); for (CoverageDimensionInfo cd : dimensions) { element("wcs:Key", cd.getName().replace(' ', '_')); } end("wcs:AvailableKeys"); end("wcs:Axis"); }
Set<String> dimensionMap = new HashSet<String>(); for (int i = 0; i < dimensions.size(); i++) { String keyName = dimensions.get(i).getName().replace(' ', '_'); dimensionMap.add(keyName);
private LayerInfo validateBasicLayerStructure( String workspace, String layerName, String[] expectedNames) { // check the configuration elements are there too Catalog catalog = getCatalog(); // ... the store CoverageStoreInfo store = catalog.getCoverageStoreByName(workspace, "test123"); assertNotNull(store); assertThat(store.getFormat(), instanceOf(ImageMosaicFormat.class)); // ... the layer LayerInfo layer = catalog.getLayerByName(layerName); assertNotNull(layer); final CoverageInfo coverageInfo = (CoverageInfo) layer.getResource(); assertThat(coverageInfo.getStore(), equalTo(store)); // ... the resource is time enabled DimensionInfo dimension = coverageInfo.getMetadata().get(ResourceInfo.TIME, DimensionInfo.class); assertThat(dimension.getAttribute(), equalTo("timeStart")); assertThat(dimension.getDefaultValue().getStrategyType(), equalTo(Strategy.MAXIMUM)); // ... has the expected bands String[] names = coverageInfo .getDimensions() .stream() .map(cd -> cd.getName()) .toArray(String[]::new); assertThat(expectedNames, equalTo(names)); return layer; }
Map<String, Integer> dimensionMap = new HashMap<String, Integer>(); for (int i = 0; i < dimensions.size(); i++) { String keyName = dimensions.get(i).getName().replace(' ', '_'); dimensionMap.put(keyName, i);
cinfo.getDimensions() .stream() .map(d -> d.getName()) .collect(Collectors.toList()); for (int i = 0, j = 0;
List<CoverageDimensionInfo> dimensions = c.getDimensions(); CoverageDimensionInfo dimension = dimensions.get(0); assertEquals("RED_BAND", dimension.getName()); NumberRange range = dimension.getRange(); assertEquals(Double.NEGATIVE_INFINITY, range.getMinimum(), DELTA);
assertEquals(ci.getAbstract(), cov.getAbstract()); assertEquals( ci.getDimensions().get(0).getName(), cov.getEncodedDimensionsInfoList().get(0).getName()); assertEquals(ci.getAbstract(), cov.getAbstract()); assertEquals( ci.getDimensions().get(0).getName(), cov.getEncodedDimensionsInfoList().get(0).getName()); assertEquals("something", cov.getMetadataList().get(0).getKey());
assertEquals(ci.getAbstract(), cov.getAbstract()); assertEquals( ci.getDimensions().get(0).getName(), cov.getEncodedDimensionsInfoList().get(0).getName()); assertTrue(cov.getKeywords().contains("demmiedem"));
List<CoverageDimensionInfo> dimensions = c.getDimensions(); CoverageDimensionInfo dimension = dimensions.get(0); assertEquals("GRAY_INDEX", dimension.getName()); NumberRange range = dimension.getRange(); assertEquals(Double.NEGATIVE_INFINITY, range.getMinimum(), DELTA); dimensions = c.getDimensions(); dimension = dimensions.get(0); assertEquals("Elevation", dimension.getName()); range = dimension.getRange(); assertEquals(-100.0, range.getMinimum(), DELTA);