CoverageDimensionInfo dim = catalog.getFactory().createCoverageDimension(); GridSampleDimension sd = sampleDimensions[i]; String name = sd.getDescription().toString(Locale.getDefault()); dim.setName(name);
public static WrappedSampleDimension build( GridSampleDimension sampleDim, CoverageDimensionInfo info) { String name = info.getName(); final InternationalString sampleDimDescription = sampleDim.getDescription(); InternationalString configuredDescription = (sampleDimDescription == null
for (int i = 0; i < sd.length; i++) { writer.write("<CoverageDimension>\n"); writer.write("<name>" + sd[i].getDescription().toString() + "</name>\n"); writer.write("<interval>\n"); writer.write("<min>" + sd[i].getMinimumValue() + "</min>\n");
/** * Constructs a new sample dimension with the same categories and units than the specified * sample dimension. * * @param other The other sample dimension, or {@code null}. */ protected GridSampleDimension(final GridSampleDimension other) { if (other != null) { categories = other.categories; hasQualitative = other.hasQualitative; hasQuantitative = other.hasQuantitative; scale = other.scale; offset = other.offset; description = other.getDescription(); this.units = other.units; } else { categories = null; hasQualitative = false; hasQuantitative = false; description = Vocabulary.formatInternational(VocabularyKeys.UNTITLED); } }
return null; ftBuilder.add(sd.getDescription().toString(), bandClass);
private SimpleFeatureCollection wrapPixelInFeatureCollection( GridCoverage2D coverage, double[] pixelValues, Name coverageName) throws SchemaException { GridSampleDimension[] sampleDimensions = coverage.getSampleDimensions(); SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.setName(coverageName); final Set<String> bandNames = new HashSet<String>(); for (int i = 0; i < sampleDimensions.length; i++) { String name = descriptionToNcName(sampleDimensions[i].getDescription().toString()); // GEOS-2518 if (bandNames.contains(name)) { // it might happen again that the name already exists but it pretty difficult I'd // say name = new StringBuilder(name).append("_Band").append(i).toString(); } bandNames.add(name); builder.add(name, Double.class); } SimpleFeatureType gridType = builder.buildFeatureType(); Double[] values = new Double[pixelValues.length]; for (int i = 0; i < values.length; i++) { values[i] = new Double(pixelValues[i]); } return DataUtilities.collection(SimpleFeatureBuilder.build(gridType, values, "")); }
final List<String> bandsNames = new ArrayList<String>(); for (GridSampleDimension band : bands) { bandsNames.add(band.getDescription().toString()); if (sd instanceof GridSampleDimension) { final GridSampleDimension band = (GridSampleDimension) sd; final String name = band.getDescription().toString(); if (name.equals(startRangeComponent)) { returnValue.add(startRangeComponent);
for (int i = 0; i < numBands; i++) { GridSampleDimension dim = cov.getSampleDimension(i); sampleDimensionNames[i] = dim.getDescription().toString();
for (int i = 0; i < numBands; i++) { GridSampleDimension dim = coverage.getSampleDimension(i); sampleDimensionNames[i] = dim.getDescription().toString();
private FeatureCollection<SimpleFeatureType, SimpleFeature> wrapPixelInFeatureCollection( GridCoverage2D coverage, double[] pixelValues, String coverageName) throws SchemaException, IllegalAttributeException { GridSampleDimension[] sampleDimensions = coverage.getSampleDimensions(); SimpleFeatureType gridType; try { SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.setName(coverageName); for (int i = 0; i < sampleDimensions.length; i++) { builder.add(sampleDimensions[i].getDescription().toString(), Double.class); } gridType = builder.buildFeatureType(); } catch(Exception e) { // sometimes a grid coverage format does not assign unique descriptions to coverages SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.setName(coverageName); for (int i = 0; i < sampleDimensions.length; i++) { builder.add("Band " + (i + 1), Double.class); } gridType = builder.buildFeatureType(); } Double[] values = new Double[pixelValues.length]; for (int i = 0; i < values.length; i++) { values[i] = new Double(pixelValues[i]); } return DataUtilities.collection(SimpleFeatureBuilder.build(gridType, values, "")); }
return sampleDimension; GridSampleDimension result = new GridSampleDimension(displayDimension.getDescription(), categories, displayDimension.getUnits()); if (sampleDimension != displayDimension) {
return null; ftBuilder.add(sd.getDescription().toString(),bandClass);
BandVariable bandVariable = new BandVariable(); bandVariables[i] = bandVariable; String bandName = sampleDimensions[i].getDescription().toString(); bandVariable.variableName = bandName;