Class DefaultGridCoverageResponse

Object
DefaultGridCoverageResponse
All Implemented Interfaces:
Coverage, GridCoverage, GridCoverageResponse

public class DefaultGridCoverageResponse extends Object implements GridCoverageResponse
Default GridCoverageResponse implementation.
Author:
Daniele Romagnoli, GeoSolutions SAS
  • Constructor Details

  • Method Details

    • getTemporalExtent

      public DateRange getTemporalExtent()
      Description copied from interface: GridCoverageResponse
      Return the temporal extent of this gridcoverage
      Specified by:
      getTemporalExtent in interface GridCoverageResponse
    • getVerticalExtent

      public NumberRange<Double> getVerticalExtent()
      Description copied from interface: GridCoverageResponse
      Return the vertical extent of this gridcoverage
      Specified by:
      getVerticalExtent in interface GridCoverageResponse
    • getCoordinateReferenceSystem

      public CoordinateReferenceSystem getCoordinateReferenceSystem()
      Description copied from interface: Coverage
      Returns the coordinate reference system to which the objects in its domain are referenced. This is the CRS used when accessing a coverage or grid coverage with the evaluate(...) methods. This coordinate reference system is usually different than coordinate system of the grid. It is the target coordinate reference system of the gridToCRS math transform.

      Grid coverage can be accessed (re-projected) with new coordinate reference system with the GridCoverageProcessor component. In this case, a new instance of a grid coverage is created.

      Specified by:
      getCoordinateReferenceSystem in interface Coverage
      Returns:
      The coordinate reference system used when accessing a coverage or grid coverage with the evaluate(...) methods.
    • getEnvelope

      public Bounds getEnvelope()
      Description copied from interface: Coverage
      The bounding box for the coverage domain in coordinate reference system coordinates. For grid coverages, the grid cells are centered on each grid coordinate. The envelope for a 2-D grid coverage includes the following corner positions.
       (Minimum row - 0.5, Minimum column - 0.5) for the minimum coordinates
       (Maximum row - 0.5, Maximum column - 0.5) for the maximum coordinates
       
      If a grid coverage does not have any associated coordinate reference system, the minimum and maximum coordinate points for the envelope will be empty sequences.
      Specified by:
      getEnvelope in interface Coverage
      Returns:
      The bounding box for the coverage domain in coordinate system coordinates.
    • getRangeType

      public RecordType getRangeType()
      Description copied from interface: Coverage
      Describes the range of the coverage. It consists of a list of attribute name/data type pairs. A simple list is the most common form of range type, but RecordType can be used recursively to describe more complex structures. The range type for a specific coverage shall be specified in an application schema.
      Specified by:
      getRangeType in interface Coverage
      Returns:
      The coverage range.
    • evaluate

      Description copied from interface: Coverage
      Returns a set of records of feature attribute values for the specified direct position. The parameter list is a sequence of feature attribute names each of which identifies a field of the range type. If list is null, the operation shall return a value for every field of the range type. Otherwise, it shall return a value for each field included in list. If the direct position passed is not in the domain of the coverage, then an exception is thrown. If the input direct position falls within two or more geometric objects within the domain, the operation shall return records of feature attribute values computed according to the common point rule.

      NOTE: Normally, the operation will return a single record of feature attribute values.

      Specified by:
      evaluate in interface Coverage
      Parameters:
      p - The position where to evaluate.
      list - The field of interest, or null for every fields.
      Returns:
      The feature attributes.
      Throws:
      PointOutsideCoverageException - if the point is outside the coverage domain.
      CannotEvaluateException - If the point can't be evaluated for some other reason.
    • evaluate

      Description copied from interface: Coverage
      Return the value vector for a given point in the coverage. A value for each sample dimension is included in the vector. The default interpolation type used when accessing grid values for points which fall between grid cells is nearest neighbor.

      The coordinate reference system of the point is the same as the grid coverage coordinate reference system (specified by the Coverage.getCoordinateReferenceSystem() method).

      WARNING: This method is inherited from the legacy OGC 01-004 specification and may be deprecated in a future version. We are for more experience and feedbacks on the value of this method.

      Specified by:
      evaluate in interface Coverage
      Parameters:
      point - Point at which to find the grid values.
      Returns:
      The value vector for a given point in the coverage.
      Throws:
      PointOutsideCoverageException - if the point is outside the coverage envelope.
      CannotEvaluateException - If the point can't be evaluated for some other reason.
      See Also:
    • evaluate

      public boolean[] evaluate(Position point, boolean[] destination) throws PointOutsideCoverageException, CannotEvaluateException, ArrayIndexOutOfBoundsException
      Description copied from interface: Coverage
      Return a sequence of boolean values for a given point in the coverage. A value for each sample dimension is included in the sequence. The default interpolation type used when accessing grid values for points which fall between grid cells is nearest neighbor.

      The coordinate reference system of the point is the same as the grid coverage coordinate reference system (specified by the Coverage.getCoordinateReferenceSystem() method).

      Specified by:
      evaluate in interface Coverage
      Parameters:
      point - Point at which to find the coverage values.
      destination - An optionally preallocated array in which to store the values, or null if none.
      Returns:
      A sequence of boolean values for a given point in the coverage. If destination was non-null, then it is returned. Otherwise, a new array is allocated and returned.
      Throws:
      PointOutsideCoverageException - if the point is outside the coverage envelope.
      CannotEvaluateException - if the point can't be evaluated for some othe reason.
      ArrayIndexOutOfBoundsException - if the destination array is not null and too small to hold the output.
    • evaluate

      public byte[] evaluate(Position point, byte[] destination) throws PointOutsideCoverageException, CannotEvaluateException, ArrayIndexOutOfBoundsException
      Description copied from interface: Coverage
      Return a sequence of unsigned byte values for a given point in the coverage. A value for each sample dimension is included in the sequence. The default interpolation type used when accessing grid values for points which fall between grid cells is nearest neighbor.

      The coordinate reference system of the point is the same as the grid coverage coordinate reference system (specified by the Coverage.getCoordinateReferenceSystem() method).

      Specified by:
      evaluate in interface Coverage
      Parameters:
      point - Point at which to find the coverage values.
      destination - An optionally preallocated array in which to store the values, or null if none.
      Returns:
      A sequence of unsigned byte values for a given point in the coverage. If destination was non-null, then it is returned. Otherwise, a new array is allocated and returned.
      Throws:
      PointOutsideCoverageException - if the point is outside the coverage envelope.
      CannotEvaluateException - if the point can't be evaluated for some othe reason.
      ArrayIndexOutOfBoundsException - if the destination array is not null and too small to hold the output.
    • evaluate

      public int[] evaluate(Position point, int[] destination) throws PointOutsideCoverageException, CannotEvaluateException, ArrayIndexOutOfBoundsException
      Description copied from interface: Coverage
      Return a sequence of integer values for a given point in the coverage. A value for each sample dimension is included in the sequence. The default interpolation type used when accessing grid values for points which fall between grid cells is nearest neighbor.

      The coordinate reference system of the point is the same as the grid coverage coordinate reference system (specified by the Coverage.getCoordinateReferenceSystem() method).

      Specified by:
      evaluate in interface Coverage
      Parameters:
      point - Point at which to find the grid values.
      destination - An optionally preallocated array in which to store the values, or null if none.
      Returns:
      A sequence of integer values for a given point in the coverage. If destination was non-null, then it is returned. Otherwise, a new array is allocated and returned.
      Throws:
      PointOutsideCoverageException - if the point is outside the coverage envelope.
      CannotEvaluateException - if the point can't be evaluated for some othe reason.
      ArrayIndexOutOfBoundsException - if the destination array is not null and too small to hold the output.
      See Also:
    • evaluate

      public float[] evaluate(Position point, float[] destination) throws PointOutsideCoverageException, CannotEvaluateException, ArrayIndexOutOfBoundsException
      Description copied from interface: Coverage
      Return a sequence of float values for a given point in the coverage. A value for each sample dimension is included in the sequence. The default interpolation type used when accessing grid values for points which fall between grid cells is nearest neighbor.

      The coordinate reference system of the point is the same as the grid coverage coordinate reference system (specified by the Coverage.getCoordinateReferenceSystem() method).

      Specified by:
      evaluate in interface Coverage
      Parameters:
      point - Point at which to find the grid values.
      destination - An optionally preallocated array in which to store the values, or null if none.
      Returns:
      A sequence of float values for a given point in the coverage. If destination was non-null, then it is returned. Otherwise, a new array is allocated and returned.
      Throws:
      PointOutsideCoverageException - if the point is outside the coverage envelope.
      CannotEvaluateException - if the point can't be evaluated for some othe reason.
      ArrayIndexOutOfBoundsException - if the destination array is not null and too small to hold the output.
      See Also:
    • evaluate

      public double[] evaluate(Position point, double[] destination) throws PointOutsideCoverageException, CannotEvaluateException, ArrayIndexOutOfBoundsException
      Description copied from interface: Coverage
      Return a sequence of double values for a given point in the coverage. A value for each sample dimension is included in the sequence. The default interpolation type used when accessing grid values for points which fall between grid cells is nearest neighbor.

      The coordinate reference system of the point is the same as the grid coverage coordinate reference system (specified by the Coverage.getCoordinateReferenceSystem() method).

      Specified by:
      evaluate in interface Coverage
      Parameters:
      point - Point at which to find the grid values.
      destination - An optionally preallocated array in which to store the values, or null if none.
      Returns:
      A sequence of double values for a given point in the coverage. If destination was non-null, then it is returned. Otherwise, a new array is allocated and returned.
      Throws:
      PointOutsideCoverageException - if the point is outside the coverage envelope.
      CannotEvaluateException - If the point can't be evaluated for some othe reason.
      ArrayIndexOutOfBoundsException - if the destination array is not null and too small to hold the output.
      See Also:
    • getNumSampleDimensions

      public int getNumSampleDimensions()
      Description copied from interface: Coverage
      The number of sample dimensions in the coverage. For grid coverages, a sample dimension is a band.

      WARNING: This method is inherited from the legacy OGC 01-004 specification and may be deprecated in a future version. We are for more experience and feedbacks on the value of this method.

      Specified by:
      getNumSampleDimensions in interface Coverage
      Returns:
      The number of sample dimensions in the coverage.
    • getSampleDimension

      public SampleDimension getSampleDimension(int index) throws IndexOutOfBoundsException
      Description copied from interface: Coverage
      Retrieve sample dimension information for the coverage. For a grid coverage a sample dimension is a band. The sample dimension information include such things as description, data type of the value (bit, byte, integer...), the no data values, minimum and maximum values and a color table if one is associated with the dimension. A coverage must have at least one sample dimension.

      WARNING: This method is inherited from the legacy OGC 01-004 specification and may be deprecated in a future version. We are for more experience and feedbacks on the value of this method.

      Specified by:
      getSampleDimension in interface Coverage
      Parameters:
      index - Index for sample dimension to retrieve. Indices are numbered 0 to (n-1).
      Returns:
      Sample dimension information for the coverage.
      Throws:
      IndexOutOfBoundsException - if index is out of bounds.
    • getRenderableImage

      public RenderableImage getRenderableImage(int xAxis, int yAxis) throws UnsupportedOperationException, IndexOutOfBoundsException
      Description copied from interface: Coverage
      Returns 2D view of this coverage as a renderable image. This optional operation allows interoperability with Java2D. If this coverage is a GridCoverage backed by a RenderedImage, the underlying image can be obtained with: getRenderableImage(0,1).createDefaultRendering()
      Specified by:
      getRenderableImage in interface Coverage
      Parameters:
      xAxis - Dimension to use for the x axis.
      yAxis - Dimension to use for the y axis.
      Returns:
      A 2D view of this coverage as a renderable image.
      Throws:
      UnsupportedOperationException - if this optional operation is not supported.
      IndexOutOfBoundsException - if xAxis or yAxis is out of bounds.
    • isDataEditable

      public boolean isDataEditable()
      Description copied from interface: GridCoverage
      Returns true if grid data can be edited.
      Specified by:
      isDataEditable in interface GridCoverage
      Returns:
      true if grid data can be edited.
    • getGridGeometry

      public GridGeometry getGridGeometry()
      Description copied from interface: GridCoverage
      Information for the grid coverage geometry. Grid geometry includes the valid range of grid coordinates and the georeferencing.
      Specified by:
      getGridGeometry in interface GridCoverage
      Returns:
      The information for the grid coverage geometry.
    • getOptimalDataBlockSizes

      public int[] getOptimalDataBlockSizes()
      Description copied from interface: GridCoverage
      Optimal size to use for each dimension when accessing grid values. These values together give the optimal block size to use when retrieving grid coverage values. For example, a client application can achieve better performance for a 2-D grid coverage by reading blocks of 128 by 128 if the grid is tiled into blocks of this size. The sequence is ordered by dimension. If the implementation does not have optimal sizes, the sequence will be null.
      Specified by:
      getOptimalDataBlockSizes in interface GridCoverage
      Returns:
      The optimal size to use for each dimension when accessing grid values, or null if none.
    • getNumOverviews

      public int getNumOverviews()
      Description copied from interface: GridCoverage
      Number of predetermined overviews for the grid.
      Specified by:
      getNumOverviews in interface GridCoverage
      Returns:
      The number of predetermined overviews for the grid.
    • getOverviewGridGeometry

      public GridGeometry getOverviewGridGeometry(int index) throws IndexOutOfBoundsException
      Description copied from interface: GridCoverage
      Returns the grid geometry for an overview.
      Specified by:
      getOverviewGridGeometry in interface GridCoverage
      Parameters:
      index - Overview index for which to retrieve grid geometry. Indices start at 0.
      Returns:
      The grid geometry for an overview.
      Throws:
      IndexOutOfBoundsException - if overviewIndex is out of bounds.
    • getOverview

      public GridCoverage getOverview(int index) throws IndexOutOfBoundsException
      Description copied from interface: GridCoverage
      Returns a pre-calculated overview for a grid coverage. The overview indices are numbered from 0 to numberOverviews-1. The overviews are ordered from highest (index 0) to lowest (numberOverviews-1 ) resolution. Overview grid coverages will have overviews which are the overviews for the grid coverage with lower resolution than the overview. For example, a 1 meter grid coverage with 3, 9, and 27 meter overviews will be ordered as in the left side below. The 3 meter overview will have 2 overviews as in the right side below:
      1 meter GC   3 meter overview
      Index   resolution
      0 3
      1 9
      2 27
                  
      Index   resolution
      0 9
      1 27
      Specified by:
      getOverview in interface GridCoverage
      Parameters:
      index - Index of grid coverage overview to retrieve. Indexes start at 0.
      Returns:
      A pre-calculated overview for a grid coverage.
      Throws:
      IndexOutOfBoundsException - if overviewIndex is out of bounds.
    • getSources

      public List<GridCoverage> getSources()
      Description copied from interface: GridCoverage
      Returns the sources data for a grid coverage. If the GridCoverage was produced from an underlying dataset (by read(...) for instance), this method should returns an empty list.

      If the GridCoverage was produced using {link org.geotools.api.coverage.processing.GridCoverageProcessor} then it should return the source grid coverages of the one used as input to GridCoverageProcessor. In general this method is intended to return the original GridCoverage on which it depends.

      This is intended to allow applications to establish what GridCoverages will be affected when others are updated, as well as to trace back to the "raw data".

      Specified by:
      getSources in interface Coverage
      Specified by:
      getSources in interface GridCoverage
      Returns:
      The sources data for a grid coverage.
    • getRenderedImage

      public RenderedImage getRenderedImage()
      Description copied from interface: GridCoverage
      Returns grid data as a rendered image.
      Specified by:
      getRenderedImage in interface GridCoverage
    • getGridCoverage2D

      public GridCoverage2D getGridCoverage2D()
      Description copied from interface: GridCoverageResponse
      Return the underlying GridCoverage2D (responses are always 2D)
      Specified by:
      getGridCoverage2D in interface GridCoverageResponse