Package org.geotools.coverage

Examples of org.geotools.coverage.GridSampleDimension


         */
        final GridCoverage2D  coverage;  // The final grid coverage.
        final BufferedImage      image;  // The GridCoverage's data.
        final WritableRaster    raster;  // The image's data as a raster.
        final Rectangle2D       bounds;  // The GridCoverage's envelope.
        final GridSampleDimension band;  // The only image's band.
        band = new GridSampleDimension("Temperature", new Category[] {
            new Category("No data",     null, 0),
            new Category("Land",        null, 1),
            new Category("Cloud",       null, 2),
            new Category("Temperature", null, BEGIN_VALID, 256, SCALE, OFFSET)
        }, CELSIUS);
View Full Code Here


        return true;
    }

    static double getCandidateNoData(GridCoverage gc) {
        // no data management
        final GridSampleDimension sd = (GridSampleDimension) gc.getSampleDimension(0);
        final List<Category> categories = sd.getCategories();
        double inNoData = Double.NaN;
        if (categories != null) {
            Category candidate;
            final String noDataName = Vocabulary.format(VocabularyKeys.NODATA);
            for (Category category : categories) {
View Full Code Here

    pbjImageRead.add(readP);
    pbjImageRead.add(imageIOSPI.createReaderInstance());
    RenderedOp image = JAI.create("ImageRead", pbjImageRead, hints);

    // sample dimension for this coverage
    final GridSampleDimension band = getSampleDimension(max, min);

    // setting metadata
    final Map<String,Double> metadata = new HashMap<String,Double>();
    metadata.put("maximum", Double.valueOf(stats.getMax()));
    metadata.put("minimum", Double.valueOf(stats.getMin()));
View Full Code Here

   
    final Category nan =
        new Category(Vocabulary.format(VocabularyKeys.NODATA), new Color[] { new Color(0, 0, 0, 0) },
        NumberRange.create(0, 0), NumberRange.create((short) -9999,
            (short) -9999));
    final GridSampleDimension band = new GridSampleDimension(
        "digital-elevation", new Category[] { nan }, uom);

    return band.geophysics(true);
  }
View Full Code Here

                String bandName = colorInterpretation.name();
                // make sure we create no duplicate band names
                if(colorInterpretation == ColorInterpretation.UNDEFINED || bandNames.contains(bandName)) {
                    bandName = "Band" + (i + 1);
                }
                bands[i] = new GridSampleDimension(bandName,categories,null).geophysics(true);
        }
        // creating coverage
        if (raster2Model != null) {
            return coverageFactory.create(coverageName, image, crs, raster2Model,
                    bands, null, null);
View Full Code Here

        for (int i = 0; i < numBands; i++) {
            final ColorInterpretation colorInterpretation = TypeMap.getColorInterpretation(cm, i);
            if (colorInterpretation == null)
                throw new IOException("Unrecognized sample dimension type");
            Category[] categories = null;
            bands[i] = new GridSampleDimension(colorInterpretation.name(), categories, null).geophysics(true);
        }
        // creating coverage
        if (raster2Model != null) {
            return coverageFactory.create(coverageName, image, crs, raster2Model, bands, null, null);
        }
View Full Code Here

        for (int i = 0; i < numBands; i++) {
            final ColorInterpretation colorInterpretation = TypeMap
                    .getColorInterpretation(cm, i);
            if (colorInterpretation == null)
                throw new IOException("Unrecognized sample dimension type");
            bands[i] = new GridSampleDimension(colorInterpretation.name())
                    .geophysics(true);
        }

        // creating the final coverage by keeping into account the fact that we
        // can just use the envelope, but we need to use the G2W
View Full Code Here

        // build the output coverage
        //
       
       
        // build the output sample dimensions, use the default value ( 0 ) as the no data
        final GridSampleDimension outSampleDimension = new GridSampleDimension("classification",
                new Category[] { Category.NODATA }, null).geophysics(true);
        final GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null);
        final GridCoverage2D output = factory.create("reclassified", indexedClassification, coverage
                .getGridGeometry(), new GridSampleDimension[] { outSampleDimension },
                new GridCoverage[] { coverage }, new HashMap<String,Double>(){{
View Full Code Here

            this.band = band;
           
            // prepare the classification image if necessary
            if(classification != null) {
                // find nodata values
                GridSampleDimension sampleDimension = classification.getSampleDimension(0);
                double[] nodataarr = sampleDimension.getNoDataValues();
                double nodata = nodataarr != null? nodataarr[0] : Double.NaN;
   
                // this will adapt the classification image to the projection and image layout
                // of the data coverage
                classificationRaster = GridCoverage2DRIA.create(classification, dataCoverage, nodata);
View Full Code Here

                    geometryEnvelope = new ReferencedEnvelope(geometry.getEnvelopeInternal(),
                            dataCoverage.getCoordinateReferenceSystem());
                }

                // check if the novalue is != from NaN
                GridSampleDimension sampleDimension = dataCoverage.getSampleDimension(0);
                List<Category> categories = sampleDimension.getCategories();
                List<Range<Double>> novalueRangeList = null;
                if (categories != null) {
                    for (Category category : categories) {
                        String catName = category.getName().toString();
                        if (catName.equalsIgnoreCase("no data")) {
View Full Code Here

TOP

Related Classes of org.geotools.coverage.GridSampleDimension

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.