Class DefaultGridCoverageResponse
- All Implemented Interfaces:
Coverage,GridCoverage,GridCoverageResponse
- Author:
- Daniele Romagnoli, GeoSolutions SAS
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultGridCoverageResponse(GridCoverage gridCoverage, DateRange temporalExtent, NumberRange<Double> verticalExtent) -
Method Summary
Modifier and TypeMethodDescriptionReturn the value vector for a given point in the coverage.boolean[]Return a sequence of boolean values for a given point in the coverage.byte[]Return a sequence of unsigned byte values for a given point in the coverage.double[]Return a sequence of double values for a given point in the coverage.float[]Return a sequence of float values for a given point in the coverage.int[]Return a sequence of integer values for a given point in the coverage.evaluate(Position p, Collection<String> list) Returns a set of records of feature attribute values for the specified direct position.Returns the coordinate reference system to which the objects in its domain are referenced.The bounding box for the coverage domain in coordinate reference system coordinates.Return the underlying GridCoverage2D (responses are always 2D)Information for the grid coverage geometry.intNumber of predetermined overviews for the grid.intThe number of sample dimensions in the coverage.int[]Optimal size to use for each dimension when accessing grid values.getOverview(int index) Returns a pre-calculated overview for a grid coverage.getOverviewGridGeometry(int index) Returns the grid geometry for an overview.Describes the range of the coverage.getRenderableImage(int xAxis, int yAxis) Returns 2D view of this coverage as a renderable image.Returns grid data as a rendered image.getSampleDimension(int index) Retrieve sample dimension information for the coverage.Returns the sources data for a grid coverage.Return the temporal extent of this gridcoverageReturn the vertical extent of this gridcoveragebooleanReturnstrueif grid data can be edited.
-
Constructor Details
-
DefaultGridCoverageResponse
public DefaultGridCoverageResponse(GridCoverage gridCoverage, DateRange temporalExtent, NumberRange<Double> verticalExtent)
-
-
Method Details
-
getTemporalExtent
Description copied from interface:GridCoverageResponseReturn the temporal extent of this gridcoverage- Specified by:
getTemporalExtentin interfaceGridCoverageResponse
-
getVerticalExtent
Description copied from interface:GridCoverageResponseReturn the vertical extent of this gridcoverage- Specified by:
getVerticalExtentin interfaceGridCoverageResponse
-
getCoordinateReferenceSystem
Description copied from interface:CoverageReturns 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 theevaluate(...)methods. This coordinate reference system is usually different than coordinate system of the grid. It is the target coordinate reference system of thegridToCRSmath transform.Grid coverage can be accessed (re-projected) with new coordinate reference system with the
GridCoverageProcessorcomponent. In this case, a new instance of a grid coverage is created.- Specified by:
getCoordinateReferenceSystemin interfaceCoverage- Returns:
- The coordinate reference system used when accessing a coverage or grid coverage with the
evaluate(...)methods.
-
getEnvelope
Description copied from interface:CoverageThe 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.
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.(Minimum row - 0.5, Minimum column - 0.5) for the minimum coordinates (Maximum row - 0.5, Maximum column - 0.5) for the maximum coordinates
- Specified by:
getEnvelopein interfaceCoverage- Returns:
- The bounding box for the coverage domain in coordinate system coordinates.
-
getRangeType
Description copied from interface:CoverageDescribes 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, butRecordTypecan be used recursively to describe more complex structures. The range type for a specific coverage shall be specified in an application schema.- Specified by:
getRangeTypein interfaceCoverage- Returns:
- The coverage range.
-
evaluate
public Set<Record> evaluate(Position p, Collection<String> list) throws PointOutsideCoverageException, CannotEvaluateException Description copied from interface:CoverageReturns a set of records of feature attribute values for the specified direct position. The parameterlistis a sequence of feature attribute names each of which identifies a field of the range type. Iflistis null, the operation shall return a value for every field of the range type. Otherwise, it shall return a value for each field included inlist. 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:
evaluatein interfaceCoverage- Parameters:
p- The position where to evaluate.list- The field of interest, ornullfor 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
public Object evaluate(Position point) throws PointOutsideCoverageException, CannotEvaluateException Description copied from interface:CoverageReturn 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:
evaluatein interfaceCoverage- 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:CoverageReturn 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:
evaluatein interfaceCoverage- Parameters:
point- Point at which to find the coverage values.destination- An optionally preallocated array in which to store the values, ornullif none.- Returns:
- A sequence of boolean values for a given point in the coverage. If
destinationwas 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 thedestinationarray 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:CoverageReturn 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:
evaluatein interfaceCoverage- Parameters:
point- Point at which to find the coverage values.destination- An optionally preallocated array in which to store the values, ornullif none.- Returns:
- A sequence of unsigned byte values for a given point in the coverage. If
destinationwas 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 thedestinationarray 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:CoverageReturn 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:
evaluatein interfaceCoverage- Parameters:
point- Point at which to find the grid values.destination- An optionally preallocated array in which to store the values, ornullif none.- Returns:
- A sequence of integer values for a given point in the coverage. If
destinationwas 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 thedestinationarray 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:CoverageReturn 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:
evaluatein interfaceCoverage- Parameters:
point- Point at which to find the grid values.destination- An optionally preallocated array in which to store the values, ornullif none.- Returns:
- A sequence of float values for a given point in the coverage. If
destinationwas 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 thedestinationarray 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:CoverageReturn 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:
evaluatein interfaceCoverage- Parameters:
point- Point at which to find the grid values.destination- An optionally preallocated array in which to store the values, ornullif none.- Returns:
- A sequence of double values for a given point in the coverage. If
destinationwas 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 thedestinationarray is not null and too small to hold the output.- See Also:
-
getNumSampleDimensions
public int getNumSampleDimensions()Description copied from interface:CoverageThe 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:
getNumSampleDimensionsin interfaceCoverage- Returns:
- The number of sample dimensions in the coverage.
-
getSampleDimension
Description copied from interface:CoverageRetrieve 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:
getSampleDimensionin interfaceCoverage- Parameters:
index- Index for sample dimension to retrieve. Indices are numbered 0 to (n-1).- Returns:
- Sample dimension information for the coverage.
- Throws:
IndexOutOfBoundsException- ifindexis out of bounds.
-
getRenderableImage
public RenderableImage getRenderableImage(int xAxis, int yAxis) throws UnsupportedOperationException, IndexOutOfBoundsException Description copied from interface:CoverageReturns 2D view of this coverage as a renderable image. This optional operation allows interoperability with Java2D. If this coverage is aGridCoveragebacked by aRenderedImage, the underlying image can be obtained with:getRenderableImage(0,1).createDefaultRendering()- Specified by:
getRenderableImagein interfaceCoverage- 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- ifxAxisoryAxisis out of bounds.
-
isDataEditable
public boolean isDataEditable()Description copied from interface:GridCoverageReturnstrueif grid data can be edited.- Specified by:
isDataEditablein interfaceGridCoverage- Returns:
trueif grid data can be edited.
-
getGridGeometry
Description copied from interface:GridCoverageInformation for the grid coverage geometry. Grid geometry includes the valid range of grid coordinates and the georeferencing.- Specified by:
getGridGeometryin interfaceGridCoverage- Returns:
- The information for the grid coverage geometry.
-
getOptimalDataBlockSizes
public int[] getOptimalDataBlockSizes()Description copied from interface:GridCoverageOptimal 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 benull.- Specified by:
getOptimalDataBlockSizesin interfaceGridCoverage- Returns:
- The optimal size to use for each dimension when accessing grid values, or
nullif none.
-
getNumOverviews
public int getNumOverviews()Description copied from interface:GridCoverageNumber of predetermined overviews for the grid.- Specified by:
getNumOverviewsin interfaceGridCoverage- Returns:
- The number of predetermined overviews for the grid.
-
getOverviewGridGeometry
Description copied from interface:GridCoverageReturns the grid geometry for an overview.- Specified by:
getOverviewGridGeometryin interfaceGridCoverage- Parameters:
index- Overview index for which to retrieve grid geometry. Indices start at 0.- Returns:
- The grid geometry for an overview.
- Throws:
IndexOutOfBoundsException- ifoverviewIndexis out of bounds.
-
getOverview
Description copied from interface:GridCoverageReturns a pre-calculated overview for a grid coverage. The overview indices are numbered from 0 tonumberOverviews-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:
getOverviewin interfaceGridCoverage- Parameters:
index- Index of grid coverage overview to retrieve. Indexes start at 0.- Returns:
- A pre-calculated overview for a grid coverage.
- Throws:
IndexOutOfBoundsException- ifoverviewIndexis out of bounds.
-
getSources
Description copied from interface:GridCoverageReturns the sources data for a grid coverage. If theGridCoveragewas produced from an underlying dataset (byread(...)for instance), this method should returns an empty list.If the
GridCoveragewas produced using {link org.geotools.api.coverage.processing.GridCoverageProcessor} then it should return the source grid coverages of the one used as input toGridCoverageProcessor. In general this method is intended to return the originalGridCoverageon 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:
getSourcesin interfaceCoverage- Specified by:
getSourcesin interfaceGridCoverage- Returns:
- The sources data for a grid coverage.
-
getRenderedImage
Description copied from interface:GridCoverageReturns grid data as a rendered image.- Specified by:
getRenderedImagein interfaceGridCoverage
-
getGridCoverage2D
Description copied from interface:GridCoverageResponseReturn the underlying GridCoverage2D (responses are always 2D)- Specified by:
getGridCoverage2Din interfaceGridCoverageResponse
-