|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface GridCoverageReference
Reference to a GridCoverage2D. This object holds some metadata about the coverage
(time range, geographic
bounding box, etc.) without the need to open the image file, since the metadata
are extracted from the database. The actual loading of pixel values occurs when
CoverageStack.Element.getCoverage(IIOListeners) is invoked for the first time.
Usage example:
CoverageDatabase db = new CoverageDatabase(...);
Layer layer = db.getLayer("My Layer").result();
CoverageEnvelope envelope = layer.getEnvelope(null, null);
envelope.setHorizontalRange(...);
envelope.setVerticalRange(...);
envelope.setTimeRange(...);
GridCoverageReference ref = layer.getCoverageReference(envelope);
GridCoverage2D coverage = ref.getCoverage(null);
GridCoverageReference instances are immutable and thread-safe.
Layer.getCoverageReference(CoverageEnvelope),
Layer.getCoverageReferences(CoverageEnvelope)
| coverage/geotk-coverage-sql (download) | View source code for this class |
| Method Summary | ||
|---|---|---|
void |
abort()
Aborts the image reading. |
|
CoordinateReferenceSystem |
getCoordinateReferenceSystem(boolean includeTime)
Returns the native Coordinate Reference System of the coverage. |
|
GridCoverageReader |
getCoverageReader(GridCoverageReader recycle)
Gets a grid coverage reader which can be used for reading the coverage represented by this GridCoverageReference. |
|
Envelope |
getEnvelope()
Returns the spatio-temporal envelope of the coverage. |
|
|
getFile(Class<T> type)
Returns the path to the image file as an object of the given type. |
|
GeographicBoundingBox |
getGeographicBoundingBox()
Returns the geographic bounding box of the coverage envelope. |
|
GridGeometry2D |
getGridGeometry()
Returns the coverage grid geometry. |
|
String |
getImageFormat()
Returns the image format. |
|
String |
getName()
Returns a name for the coverage, for use in graphical user interfaces. |
|
GridSampleDimension[] |
getSampleDimensions()
Returns the coverage sample dimensions, or null if unknown. |
|
DateRange |
getTimeRange()
Returns the temporal part of the coverage envelope. |
|
Rectangle2D |
getXYRange()
Returns the range of values in the two first dimensions, which are horizontal. |
|
NumberRange<?> |
getZRange()
Returns the range of values in the third dimension, which may be vertical or temporal. |
|
GridCoverage2D |
read(CoverageEnvelope envelope,
IIOListeners listeners)
Reads the data and returns the coverage. |
|
| Methods inherited from interface CoverageStack.Element |
|---|
getCoverage |
| Method Detail |
|---|
String getName()
getName in interface CoverageStack.Element
<T> T getFile(Class<T> type)
throws IOException
File, URL and
URI types.
In the particular case of input of the File type, the returned path
is expected to be absolute. If the file is not
absolute, then the file is probably not accessible on the local machine (i.e. the
path is relative to a distant server and can not be represented as a File
object). In such case, consider using the URI type instead.
T - The compile-time type of the type argument.type - The desired input type: File, URL or
URI.
IOException - If the input can not be represented as an object of the given type.String getImageFormat()
ImageIO.getImageReadersByFormatName(String).
CoordinateReferenceSystem getCoordinateReferenceSystem(boolean includeTime)
includeTime - true if the returned CRS should include the time component
(if available), or false for a spatial-only CRS.
GeographicBoundingBox getGeographicBoundingBox()
This method return null if the geographic bounding box can not be computed.
null if unknown.Envelope getEnvelope()
getXYRange(), getZRange() and
getTimeRange() instead.
This method is equivalent to the following call:
return getGridGeometry().getEnvelope();
getEnvelope in interface CoverageStack.ElementRectangle2D getXYRange()
If the range of values in units of the coverage CRS is desired, then use the
getEnvelope() method instead.
NumberRange<?> getZRange()
Unit of measurement
This method returns the range in units of the database vertical or temporal CRS, which
may not be the same than the vertical or temporal CRS of the coverage. This is done that
way in order to allow sorting coverages by elevation or by time no matter how the coverage
represents those quantities. If elevation or time in units of the coverage CRS is desired,
then use the getEnvelope() method instead.
getZRange in interface CoverageStack.ElementDateRange getTimeRange()
Invoking this method is equivalent to extracting the temporal component of the envelope and transforming the coordinates if needed.
GridGeometry2D getGridGeometry()
getGridGeometry in interface CoverageStack.ElementGridSampleDimension[] getSampleDimensions()
null if unknown.
This method returns always the geophysics version of sample dimensions
(geophysics(true)), which is
consistent with the coverage returned by getCoverage(...).
getSampleDimensions in interface CoverageStack.Elementnull if unknown.
GridCoverageReader getCoverageReader(GridCoverageReader recycle)
throws CoverageStoreException
GridCoverageReference. This method is provided for inter-operability with
API requirying GridCoverageReader instances. When possible, callers are encouraged
to use the read(CoverageEnvelope, IIOListeners) method instead.
This method accepts an optional GridCoverageReader instance in argument. The
provided instance will be recycled if possible, for avoiding the cost of creating a
new reader on each method invocation. If the argument is null or the given
instance can not be reused, then this method returns a new instance.
Callers should set the input
to null, reset or
dispose the reader as soon as the reading
process is completed, in order to close the underlying image input stream.
recycle - An optional existing instance to recycle if possible, or null.
CoverageStoreException - if an error occurred while creating the reader.
GridCoverage2D read(CoverageEnvelope envelope,
IIOListeners listeners)
throws CoverageStoreException,
CancellationException
envelope
parameter, which restrict the spatio-temporal extent of data to be read. If the envelope
is null, then the default extent is loaded.
The default Geotk implementation cache the returned coverage if and only if the envelope is null. In the later case, if the coverage has already been read previously and has not yet been reclaimed by the garbage collector, then the existing coverage may be returned immediately.
This method returns always the geophysics view of data.
envelope - The spatio-temporal envelope and the preferred resolution of the image
to be read, or null for the default.listeners - Objects to inform about progress, or null if none.
CoverageStoreException - if an error occurred while reading the image.
CancellationException - if abort() has been invoked during the reading process.void abort()
read(...) was in progress at the time this method is invoked, then it will stop and
throw CancellationException.
Note that if more than one read was in progress concurrently, all of them will be aborted by the call to this method.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||