| org.geotools.coverage.AbstractCoverage org.geotools.coverage.grid.AbstractGridCoverage org.geotools.coverage.grid.GridCoverage2D
All known Subclasses: org.geotools.coverage.processing.operation.Resampler2D, org.geotools.coverage.grid.Interpolator2D, org.geotools.coverage.processing.operation.ScaledGridCoverage2D, org.geotools.coverage.processing.operation.SubsampleAveragedCoverage, org.geotools.coverage.processing.operation.CroppedCoverage2D, org.geotools.coverage.processing.operation.BandSelector2D, org.geotools.coverage.processing.operation.FilteredSubsampledGridCoverage2D,
GridCoverage2D | public class GridCoverage2D extends AbstractGridCoverage implements RenderedCoverage(Code) | | Basic access to grid data values backed by a two-dimensional
. Each band in an image is represented as a
.
Grid coverages are usually two-dimensional. However,
may have more than two dimensions. For example, a remote sensing image may be valid only over
some time range (the time of satellite pass over the observed area). Envelopes for such grid
coverage can have three dimensions: the two usual ones (horizontal extent along x
and y), and a third one for start time and end time (time extent along t).
However, the
for all extra-dimension must
have a
not greater than 1. In other words, a
GridCoverage2D can be a slice in a 3 dimensional grid coverage. Each slice can have an
arbitrary width and height (like any two-dimensional images), but only 1 voxel depth (a "voxel"
is a three-dimensional pixel).
Serialization note:
Because it is serializable,
GridCoverage2D can be included as method argument or as
return type in Remote Method Invocation (RMI). However, the pixel data are not
sent during serialization. Instead, the image data are transmitted "on-demand" using socket
communications. This mechanism is implemented using JAI
SerializableRenderedImage class. While serialization (usually on server side) should work on J2SE 1.4 and above,
deserialization (usually on client side) of
GridCoverage2D instances requires J2SE 1.5.
since: 2.1 version: $Id: GridCoverage2D.java 26655 2007-08-22 13:57:25Z desruisseaux $ author: Martin Desruisseaux |
Field Summary | |
final protected GridGeometry2D | gridGeometry The grid geometry. | final protected transient PlanarImage | image The raster data. | transient String | tileEncoding The preferred encoding to use for serialization using the
writeObject method,
or
null for the default encoding. |
Method Summary | |
protected GridCoverage2D | createGeophysics(boolean geo) Invoked by
GridCoverage2D.geophysics(boolean) when the packed or geophysics companion of this
grid coverage need to be created. | public synchronized boolean | dispose(boolean force) Provides a hint that a coverage will no longer be accessed from a reference in user space.
This method
the
only if at
least one of the following conditions is true (otherwise this method do nothing):
-
force is
true , or
- The underlying
has no
other than the views (geophysics, display, etc.).
This safety check helps to prevent the disposal of an
that still
used in a JAI operation chain. | public Object | evaluate(DirectPosition point) Returns the value vector for a given point in the coverage. | public byte[] | evaluate(DirectPosition coord, byte[] dest) Returns a sequence of byte values for a given point in the coverage.
Parameters: coord - The coordinate point where to evaluate. Parameters: dest - An array in which to store values, or null . | public int[] | evaluate(DirectPosition coord, int[] dest) Returns a sequence of integer values for a given point in the coverage.
Parameters: coord - The coordinate point where to evaluate. Parameters: dest - An array in which to store values, or null . | public float[] | evaluate(DirectPosition coord, float[] dest) Returns a sequence of float values for a given point in the coverage.
Parameters: coord - The coordinate point where to evaluate. Parameters: dest - An array in which to store values, or null . | public double[] | evaluate(DirectPosition coord, double[] dest) Returns a sequence of double values for a given point in the coverage.
Parameters: coord - The coordinate point where to evaluate. Parameters: dest - An array in which to store values, or null . | public int[] | evaluate(Point2D coord, int[] dest) Returns a sequence of integer values for a given two-dimensional point in the coverage.
Parameters: coord - The coordinate point where to evaluate. Parameters: dest - An array in which to store values, or null . | public float[] | evaluate(Point2D coord, float[] dest) Returns a sequence of float values for a given two-dimensional point in the coverage.
Parameters: coord - The coordinate point where to evaluate. Parameters: dest - An array in which to store values, or null . | public double[] | evaluate(Point2D coord, double[] dest) Returns a sequence of double values for a given two-dimensional point in the coverage.
Parameters: coord - The coordinate point where to evaluate. Parameters: dest - An array in which to store values, or null . | public GridCoverage2D | geophysics(boolean geo) If
true , returns the geophysics companion of this grid coverage. | public CoordinateReferenceSystem | getCoordinateReferenceSystem2D() Returns the two-dimensional part of this grid coverage CRS. | public synchronized String | getDebugString(DirectPosition coord) Returns a debug string for the specified coordinate. | public Envelope | getEnvelope() Returns the bounding box for the coverage domain in coordinate reference system coordinates.
The returned envelope have at least two dimensions. | public Envelope2D | getEnvelope2D() Returns the two-dimensional bounding box for the coverage domain in coordinate reference
system coordinates. | public GridGeometry | getGridGeometry() Returns information for the grid coverage geometry. | public Interpolation | getInterpolation() Returns the interpolation used for all
evaluate(...) methods. | public int | getNumSampleDimensions() Returns the number of bands in the grid coverage. | public int[] | getOptimalDataBlockSizes() Returns the optimal size to use for each dimension when accessing grid values. | public RenderableImage | getRenderableImage(int xAxis, int yAxis) Returns 2D view of this grid coverage as a renderable image.
This method allows interoperability with Java2D.
Parameters: xAxis - Dimension to use for x axis. Parameters: yAxis - Dimension to use for y axis. | public RenderedImage | getRenderedImage() Returns grid data as a rendered image. | public SampleDimension | getSampleDimension(int index) Retrieve sample dimension information for the coverage.
For a grid coverage, a sample dimension is a band. | public GridSampleDimension[] | getSampleDimensions() Returns all sample dimensions for this grid coverage. | public boolean | isDataEditable() Returns
true if grid data can be edited. | public void | prefetch(Rectangle2D area) Hints that the given area may be needed in the near future. | public void | show(String title, int xAxis, int yAxis) | public void | show(String title) |
image | final protected transient PlanarImage image(Code) | | The raster data.
|
tileEncoding | transient String tileEncoding(Code) | | The preferred encoding to use for serialization using the
writeObject method,
or
null for the default encoding. This value is set by
GridCoverageFactory according the hints provided to the factory.
|
GridCoverage2D | protected GridCoverage2D(CharSequence name, GridCoverage2D coverage)(Code) | | Construct a new grid coverage with the same parameter than the specified
coverage. This constructor is useful when creating a coverage with
identical data, but in which some method has been overridden in order to
process data differently (e.g. interpolating them).
Parameters: name - The name for this coverage, or null for the same than coverage . Parameters: coverage - The source grid coverage. |
GridCoverage2D | protected GridCoverage2D(CharSequence name, PlanarImage image, GridGeometry2D gridGeometry, GridSampleDimension[] bands, GridCoverage[] sources, Map properties) throws IllegalArgumentException(Code) | | Constructs a grid coverage with the specified
and
. The
(including the
) is
inferred from the grid geometry.
This constructor accepts an optional set of properties. "Properties" in Java Advanced
Imaging is what OpenGIS calls "Metadata". Keys are
String objects
(
CaselessStringKey are accepted as well), while values may be any
Object .
Parameters: name - The grid coverage name. Parameters: image - The image. Parameters: gridGeometry - The grid geometry (must contains an with its and a "" transform). Parameters: bands - Sample dimensions for each image band, or null for default sampledimensions. If non-null, then this array's length must matches the numberof bands in image . Parameters: sources - The sources for this grid coverage, or null if none. Parameters: properties - The set of properties for this coverage, or null none. throws: IllegalArgumentException - if the number of bands differs from the number of sampledimensions. since: 2.2 |
createGeophysics | protected GridCoverage2D createGeophysics(boolean geo)(Code) | | Invoked by
GridCoverage2D.geophysics(boolean) when the packed or geophysics companion of this
grid coverage need to be created. Subclasses may override this method in order to modify
the object to be created.
Parameters: geo - true to get a grid coverage with sample values equals togeophysics values, or false to get the packed version. The newly created grid coverage. |
dispose | public synchronized boolean dispose(boolean force)(Code) | | Provides a hint that a coverage will no longer be accessed from a reference in user space.
This method
the
only if at
least one of the following conditions is true (otherwise this method do nothing):
-
force is
true , or
- The underlying
has no
other than the views (geophysics, display, etc.).
This safety check helps to prevent the disposal of an
that still
used in a JAI operation chain. It doesn't prevent the disposal in every cases however.
When unsure about whatever a coverage is still in use or not, it is safer to not invoke
this method and rely on the garbage collector instead.
See Also: PlanarImage.dispose since: 2.4 |
evaluate | public Object evaluate(DirectPosition point) throws CannotEvaluateException(Code) | | Returns the value vector for a given point in the coverage.
A value for each sample dimension is included in the vector.
|
evaluate | public byte[] evaluate(DirectPosition coord, byte[] dest) throws CannotEvaluateException(Code) | | Returns a sequence of byte values for a given point in the coverage.
Parameters: coord - The coordinate point where to evaluate. Parameters: dest - An array in which to store values, or null . An array containing values. throws: CannotEvaluateException - if the values can't be computed at the specified coordinate.More specifically, PointOutsideCoverageException is thrown if the evaluationfailed because the input point has invalid coordinates. |
evaluate | public int[] evaluate(DirectPosition coord, int[] dest) throws CannotEvaluateException(Code) | | Returns a sequence of integer values for a given point in the coverage.
Parameters: coord - The coordinate point where to evaluate. Parameters: dest - An array in which to store values, or null . An array containing values. throws: CannotEvaluateException - if the values can't be computed at the specified coordinate.More specifically, PointOutsideCoverageException is thrown if the evaluationfailed because the input point has invalid coordinates. |
evaluate | public float[] evaluate(DirectPosition coord, float[] dest) throws CannotEvaluateException(Code) | | Returns a sequence of float values for a given point in the coverage.
Parameters: coord - The coordinate point where to evaluate. Parameters: dest - An array in which to store values, or null . An array containing values. throws: CannotEvaluateException - if the values can't be computed at the specified coordinate.More specifically, PointOutsideCoverageException is thrown if the evaluationfailed because the input point has invalid coordinates. |
evaluate | public double[] evaluate(DirectPosition coord, double[] dest) throws CannotEvaluateException(Code) | | Returns a sequence of double values for a given point in the coverage.
Parameters: coord - The coordinate point where to evaluate. Parameters: dest - An array in which to store values, or null . An array containing values. throws: CannotEvaluateException - if the values can't be computed at the specified coordinate.More specifically, PointOutsideCoverageException is thrown if the evaluationfailed because the input point has invalid coordinates. |
evaluate | public int[] evaluate(Point2D coord, int[] dest) throws CannotEvaluateException(Code) | | Returns a sequence of integer values for a given two-dimensional point in the coverage.
Parameters: coord - The coordinate point where to evaluate. Parameters: dest - An array in which to store values, or null . An array containing values. throws: CannotEvaluateException - if the values can't be computed at the specified coordinate.More specifically, PointOutsideCoverageException is thrown if the evaluationfailed because the input point has invalid coordinates. |
evaluate | public float[] evaluate(Point2D coord, float[] dest) throws CannotEvaluateException(Code) | | Returns a sequence of float values for a given two-dimensional point in the coverage.
Parameters: coord - The coordinate point where to evaluate. Parameters: dest - An array in which to store values, or null . An array containing values. throws: CannotEvaluateException - if the values can't be computed at the specified coordinate.More specifically, PointOutsideCoverageException is thrown if the evaluationfailed because the input point has invalid coordinates. |
evaluate | public double[] evaluate(Point2D coord, double[] dest) throws CannotEvaluateException(Code) | | Returns a sequence of double values for a given two-dimensional point in the coverage.
Parameters: coord - The coordinate point where to evaluate. Parameters: dest - An array in which to store values, or null . An array containing values. throws: CannotEvaluateException - if the values can't be computed at the specified coordinate.More specifically, PointOutsideCoverageException is thrown if the evaluationfailed because the input point has invalid coordinates. |
geophysics | public GridCoverage2D geophysics(boolean geo)(Code) | | If
true , returns the geophysics companion of this grid coverage. In a
geophysics grid coverage, all sample values are equals to geophysics
("real world") values without the need for any transformation. In such geophysics
coverage, the
transform is the identity transform for all sample dimensions. "No data" values are
expressed by
numbers.
This method may be understood as applying the JAI's
operation with breakpoints specified by the
Category objects in
each sample dimension. However, it is more general in that the transformation specified
with each breakpoint doesn't need to be linear. On an implementation note, this method
will really try to use the first of the following operations which is found applicable:
identity,
,
,
and in last ressort a more general
(but slower) sample transcoding algorithm.
GridCoverage objects live by pair: a geophysics one (used for
computation) and a non-geophysics one (used for packing data, usually as
integers). The
geo argument specifies which object from the pair is wanted,
regardless if this method is invoked on the geophysics or non-geophysics instance of the
pair. In other words, the result of
geophysics(b1).geophysics(b2).geophysics(b3) depends only on the value in the last call (
b3 ).
Parameters: geo - true to get a grid coverage with sample values equals to geophysicsvalues, or false to get the packed version. The grid coverage. Never null , but may be this . See Also: GridSampleDimension.geophysics See Also: Category.geophysics See Also: LookupDescriptor See Also: RescaleDescriptor See Also: PiecewiseDescriptor |
getCoordinateReferenceSystem2D | public CoordinateReferenceSystem getCoordinateReferenceSystem2D()(Code) | | Returns the two-dimensional part of this grid coverage CRS. This is usually (but not
always) identical to the
.
See Also: GridCoverage2D.getCoordinateReferenceSystem |
getDebugString | public synchronized String getDebugString(DirectPosition coord)(Code) | | Returns a debug string for the specified coordinate. This method produces a
string with pixel coordinates and pixel values for all bands (with geophysics
values or category name in parenthesis). Example for a 1-banded image:
(1171,1566)=[196 (29.6 °C)]
Parameters: coord - The coordinate point where to evaluate. A string with pixel coordinates and pixel values at the specified location,or null if coord is outside coverage. |
getEnvelope | public Envelope getEnvelope()(Code) | | Returns the bounding box for the coverage domain in coordinate reference system coordinates.
The returned envelope have at least two dimensions. It may have more dimensions if the
coverage has some extent in other dimensions (for example a depth, or a start and end time).
|
getEnvelope2D | public Envelope2D getEnvelope2D()(Code) | | Returns the two-dimensional bounding box for the coverage domain in coordinate reference
system coordinates. If the coverage envelope has more than two dimensions, only the
dimensions used in the underlying rendered image are returned.
|
getGridGeometry | public GridGeometry getGridGeometry()(Code) | | Returns information for the grid coverage geometry. Grid geometry
includes the valid range of grid coordinates and the georeferencing.
|
getInterpolation | public Interpolation getInterpolation()(Code) | | Returns the interpolation used for all
evaluate(...) methods.
The default implementation returns
InterpolationNearest .
The interpolation. |
getNumSampleDimensions | public int getNumSampleDimensions()(Code) | | Returns the number of bands in the grid coverage.
|
getOptimalDataBlockSizes | public int[] getOptimalDataBlockSizes()(Code) | | Returns the optimal size to use for each dimension when accessing grid values.
The default implementation returns the image's tiles size.
|
getRenderableImage | public RenderableImage getRenderableImage(int xAxis, int yAxis)(Code) | | Returns 2D view of this grid coverage as a renderable image.
This method allows interoperability with Java2D.
Parameters: xAxis - Dimension to use for x axis. Parameters: yAxis - Dimension to use for y axis. A 2D view of this grid coverage as a renderable image. |
getRenderedImage | public RenderedImage getRenderedImage()(Code) | | Returns grid data as a rendered image.
|
getSampleDimension | public SampleDimension getSampleDimension(int index)(Code) | | 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.
|
getSampleDimensions | public GridSampleDimension[] getSampleDimensions()(Code) | | Returns all sample dimensions for this grid coverage.
|
isDataEditable | public boolean isDataEditable()(Code) | | Returns
true if grid data can be edited. The default
implementation returns
true if
GridCoverage2D.image is an
instance of
WritableRenderedImage .
|
prefetch | public void prefetch(Rectangle2D area)(Code) | | Hints that the given area may be needed in the near future. Some implementations
may spawn a thread or threads to compute the tiles while others may ignore the hint.
Parameters: area - A rectangle indicating which geographic area to prefetch.This area's coordinates must be expressed according thegrid coverage's coordinate reference system, as given byGridCoverage2D.getCoordinateReferenceSystem. |
show | public void show(String title, int xAxis, int yAxis)(Code) | | {inheritDoc}
|
Fields inherited from org.geotools.coverage.grid.AbstractGridCoverage | final public static Logger LOGGER(Code)(Java Doc)
|
Methods inherited from org.geotools.coverage.grid.AbstractGridCoverage | public boolean[] getDataBlock(GridRange range, boolean[] destination) throws InvalidRangeException, ArrayIndexOutOfBoundsException(Code)(Java Doc) public byte[] getDataBlock(GridRange range, byte[] destination) throws InvalidRangeException, ArrayIndexOutOfBoundsException(Code)(Java Doc) public short[] getDataBlock(GridRange range, short[] destination) throws InvalidRangeException, ArrayIndexOutOfBoundsException(Code)(Java Doc) public int[] getDataBlock(GridRange range, int[] destination) throws InvalidRangeException, ArrayIndexOutOfBoundsException(Code)(Java Doc) public float[] getDataBlock(GridRange range, float[] destination) throws InvalidRangeException, ArrayIndexOutOfBoundsException(Code)(Java Doc) public double[] getDataBlock(GridRange range, double[] destination) throws InvalidRangeException, ArrayIndexOutOfBoundsException(Code)(Java Doc) public GridPacking getGridPacking()(Code)(Java Doc) public int getNumOverviews()(Code)(Java Doc) public GridCoverage getOverview(int index) throws IndexOutOfBoundsException(Code)(Java Doc) public GridGeometry getOverviewGridGeometry(int index) throws IndexOutOfBoundsException(Code)(Java Doc) public byte[] getPackedDataBlock(GridRange range) throws InvalidRangeException(Code)(Java Doc) public List getSources()(Code)(Java Doc) public boolean isDataEditable()(Code)(Java Doc) protected String pointOutsideCoverage(Point2D point)(Code)(Java Doc) protected String pointOutsideCoverage(DirectPosition point)(Code)(Java Doc) public void setDataBlock(GridRange gridRange, boolean[] values) throws InvalidRangeException, GridNotEditableException, ArrayIndexOutOfBoundsException(Code)(Java Doc) public void setDataBlock(GridRange gridRange, byte[] values) throws InvalidRangeException, GridNotEditableException, ArrayIndexOutOfBoundsException(Code)(Java Doc) public void setDataBlock(GridRange gridRange, short[] values) throws InvalidRangeException, GridNotEditableException, ArrayIndexOutOfBoundsException(Code)(Java Doc) public void setDataBlock(GridRange gridRange, int[] values) throws InvalidRangeException, GridNotEditableException, ArrayIndexOutOfBoundsException(Code)(Java Doc) public void setDataBlock(GridRange gridRange, float[] values) throws InvalidRangeException, GridNotEditableException, ArrayIndexOutOfBoundsException(Code)(Java Doc) public void setDataBlock(GridRange gridRange, double[] values) throws InvalidRangeException, GridNotEditableException, ArrayIndexOutOfBoundsException(Code)(Java Doc) public void setPackedDataBlock(GridRange gridRange, byte[] values) throws InvalidRangeException, GridNotEditableException, ArrayIndexOutOfBoundsException(Code)(Java Doc) static String toString(Point2D point, Locale locale)(Code)(Java Doc) static String toString(DirectPosition point, Locale locale)(Code)(Java Doc)
|
Fields inherited from org.geotools.coverage.AbstractCoverage | final protected CoordinateReferenceSystem crs(Code)(Java Doc)
|
Methods inherited from org.geotools.coverage.AbstractCoverage | public boolean dispose(boolean force)(Code)(Java Doc) public void dispose()(Code)(Java Doc) public Set evaluate(DirectPosition coord, Set list)(Code)(Java Doc) public boolean[] evaluate(DirectPosition coord, boolean[] dest) throws CannotEvaluateException(Code)(Java Doc) public byte[] evaluate(DirectPosition coord, byte[] dest) throws CannotEvaluateException(Code)(Java Doc) public int[] evaluate(DirectPosition coord, int[] dest) throws CannotEvaluateException(Code)(Java Doc) public float[] evaluate(DirectPosition coord, float[] dest) throws CannotEvaluateException(Code)(Java Doc) public double[] evaluate(DirectPosition coord, double[] dest) throws CannotEvaluateException(Code)(Java Doc) public Set evaluateInverse(Record v)(Code)(Java Doc) public List find(DirectPosition p, int limit)(Code)(Java Doc) public GeometryValuePair find(DirectPosition p)(Code)(Java Doc) public CommonPointRule getCommonPointRule()(Code)(Java Doc) public CoordinateReferenceSystem getCoordinateReferenceSystem()(Code)(Java Doc) final public int getDimension()(Code)(Java Doc) public InternationalString[] getDimensionNames()(Code)(Java Doc) final public String[] getDimensionNames(Locale locale)(Code)(Java Doc) public Set getDomainElements()(Code)(Java Doc) public Set getDomainExtents()(Code)(Java Doc) public Envelope getEnvelope()(Code)(Java Doc) public Locale getLocale()(Code)(Java Doc) public String[] getMetadataNames()(Code)(Java Doc) public String getMetadataValue(String name) throws MetadataNameNotFoundException(Code)(Java Doc) public InternationalString getName()(Code)(Java Doc) public Set getRangeElements()(Code)(Java Doc) public RecordType getRangeType()(Code)(Java Doc) public RenderableImage getRenderableImage(int xAxis, int yAxis)(Code)(Java Doc) public List getSources()(Code)(Java Doc) public Set list()(Code)(Java Doc) public Set select(Geometry arg0, Period arg1)(Code)(Java Doc) public void show(int xAxis, int yAxis)(Code)(Java Doc) public void show(String title, int xAxis, int yAxis)(Code)(Java Doc) public void show(String title)(Code)(Java Doc) public void show()(Code)(Java Doc) public String toString()(Code)(Java Doc)
|
|
|