# Class BandedCoverage

Object
BandedCoverage

Direct Known Subclasses:
  `GridCoverage`

public abstract class BandedCoverage extends Object
A coverage where all sample values at a given location can be provided in an array of primitive type. This class does not require sample values to be "physically" stored in different bands, but it enforces similar constraints:

- Sample values are represented by a primitive type, typically `byte`, `short` or `float`.
- All sample dimensions (bands) use the same primitive type.
- Sample dimensions (bands) are accessed by band index with the first band at index 0.

## Comparison with ISO 19123

By contrast an ISO `Coverage` does not restrict sample values to primitive types, does not require all sample dimensions to use the same type, and sample values are accessed by field names instead of band indices. Said otherwise, an ISO `Coverage` can provide a complex structure (a `Record`) at every location while this `BandedCoverage` class provides only primitive arrays such as `float[]`. The effect of above restrictions appears in `getSampleDimensions()` and `BandedCoverage​.Evaluator​.apply(DirectPosition)` method signatures.

Since:
  1.1

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static interface`
  `BandedCoverage​.Evaluator`
  Computes or interpolates values of sample dimensions at given positions.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `BandedCoverage()`
  Constructs a coverage.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract BandedCoverage​.Evaluator`
  `evaluator()`
  Creates a new function for computing or interpolating sample values at given locations.
  `abstract CoordinateReferenceSystem`
  `getCoordinateReferenceSystem()`
  Returns the coordinate reference system to which the cells are referenced.
  `abstract Optional<Envelope>`
  `getEnvelope()`
  Returns the bounding box for the coverage domain in CRS coordinates.
  `abstract List<SampleDimension>`
  `getSampleDimensions()`
  Returns information about the range of this coverage.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### BandedCoverage

    protected BandedCoverage()
    Constructs a coverage.

- ## Method Details

  - ### getCoordinateReferenceSystem

    public abstract CoordinateReferenceSystem getCoordinateReferenceSystem()
    Returns the coordinate reference system to which the cells are referenced.
    Returns:
      the coordinate reference system to which the cells are referenced.
    Since:
      1.2

  - ### getEnvelope

    public abstract Optional<Envelope> getEnvelope()
    Returns the bounding box for the coverage domain in CRS coordinates. The envelope encompasses all cell surfaces, from the left border of leftmost cell to the right border of the rightmost cell and similarly along other axes.

    For most common cases, the envelope should be present. However, the return value may be empty in cases like:

    - Functional dataset: in case of a computed resource, the coverage could be potentially valid in an infinite extent (repeating pattern, random numbers for tests, etc.).
    - Computational cost: if obtaining the overall envelope is too costly, an implementation might decide to leave the result empty instead of returning a too approximate envelope. For example if a coverage aggregates a lot of data (by dynamically choosing data in a catalog upon evaluation), it might rather not compute envelope union for the entire catalog.
    - When the function does not have a clear boundary for its domain of validity, for example because the sample values accuracy decreases progressively with distance.
    Returns:
      the bounding box for the coverage domain in CRS coordinates if available.
    Since:
      1.2

  - ### getSampleDimensions

    public abstract List<SampleDimension> getSampleDimensions()
    Returns information about the range of this coverage. Information include names, sample value ranges, fill values and transfer functions for all bands in this coverage. The length of the returned list should be equal to the number of bands in rendered images.
    Returns:
      names, value ranges, fill values and transfer functions for all bands in this grid coverage.

  - ### evaluator

    public abstract BandedCoverage.Evaluator evaluator()
    Creates a new function for computing or interpolating sample values at given locations. That function accepts `DirectPosition` in arbitrary Coordinate Reference System; conversions to the coverage reference system are applied as needed.

    #### Multi-threading

    `Evaluator`s are not thread-safe. For computing sample values concurrently, a new `Evaluator` instance should be created for each thread by invoking this method multiply times.
    Returns:
      a new function for computing or interpolating sample values.