Package org.apache.sis.storage.geotiff
Class GeoTiffStore
- All Implemented Interfaces:
AutoCloseable,Aggregate,Resource,Localized
A data store backed by GeoTIFF files.
- Since:
- 0.8
Defined in the sis-geotiff module
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionGeoTiffStore(DataStore parent, DataStoreProvider provider, StorageConnector connector, boolean hidden) Creates a new GeoTIFF store as a component of a larger data store.GeoTiffStore(GeoTiffStoreProvider provider, StorageConnector connector) Creates a new GeoTIFF store from the given file, URL or stream object. -
Method Summary
Modifier and TypeMethodDescription<T extends StoreEvent>
voidaddListener(Class<T> eventType, StoreListener<? super T> listener) Registers a listener to notify when the specified kind of event occurs in this data store.voidclose()Closes this GeoTIFF store and releases any underlying resources.Returns descriptions of all images in this GeoTIFF file.findResource(String sequence) Returns the image at the given index.Returns an identifier constructed from the name of the TIFF file.Returns information about the dataset as a whole.Returns TIFF tags and GeoTIFF keys as a tree for debugging purpose.Returns the parameters used to open this GeoTIFF data store.Methods inherited from class DataStore
getDisplayName, getLocale, getProvider, removeListener, setLocale, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Resource
removeListener
-
Constructor Details
-
GeoTiffStore
public GeoTiffStore(GeoTiffStoreProvider provider, StorageConnector connector) throws DataStoreException Creates a new GeoTIFF store from the given file, URL or stream object. This constructor invokesStorageConnector.closeAllExcept(Object), keeping open only the needed resource.- Parameters:
provider- the factory that created thisDataStoreinstance, ornullif unspecified.connector- information about the storage (URL, stream, etc).- Throws:
DataStoreException- if an error occurred while opening the GeoTIFF file.
-
GeoTiffStore
public GeoTiffStore(DataStore parent, DataStoreProvider provider, StorageConnector connector, boolean hidden) throws DataStoreException Creates a new GeoTIFF store as a component of a larger data store.Example: A Landsat data set is a collection of files in a directory or ZIP file, which includes more than 10 GeoTIFF files (one image per band or product for a scene).If theLandsatStoreis a data store opening the Landsat metadata file as the main file, then opening each band/product using a GeoTIFF data store. Those bands/products are components of the Landsat data store.hiddenparameter istrue, some metadata that would normally be provided in thisGeoTiffStorewill be provided by individual components instead.- Parameters:
parent- the parent that contains this new GeoTIFF store component, ornullif none.provider- the factory that created thisDataStoreinstance, ornullif unspecified.connector- information about the storage (URL, stream, etc).hidden-trueif this GeoTIFF store will not be directly accessible from the parent. It is the case if the parent store will expose only some components instead of the GeoTIFF store itself.- Throws:
DataStoreException- if an error occurred while opening the GeoTIFF file.- Since:
- 1.1
-
-
Method Details
-
getOpenParameters
Returns the parameters used to open this GeoTIFF data store. The parameters are described byGeoTiffStoreProvider.getOpenParameters()and contains at least a parameter named "location" with aURIvalue. The return value may be empty if the storage input cannot be described by a URI (for example a GeoTIFF file reading directly from aReadableByteChannel).- Specified by:
getOpenParametersin classDataStore- Returns:
- parameters used for opening this data store.
- See Also:
-
getIdentifier
Returns an identifier constructed from the name of the TIFF file. An identifier is available only if the storage input specified at construction time was something convertible toURI, for example anURL,FileorPath.- Specified by:
getIdentifierin interfaceResource- Overrides:
getIdentifierin classDataStore- Returns:
- the identifier derived from the filename.
- Throws:
DataStoreException- if an error occurred while fetching the identifier.- Since:
- 1.0
- See Also:
-
getMetadata
Returns information about the dataset as a whole. The returned metadata object can contain information such as the spatiotemporal extent of the dataset, contact information about the creator or distributor, data quality, usage constraints and more.- Specified by:
getMetadatain interfaceResource- Specified by:
getMetadatain classDataStore- Returns:
- information about the dataset.
- Throws:
DataStoreException- if an error occurred while reading the data.- See Also:
-
getNativeMetadata
Returns TIFF tags and GeoTIFF keys as a tree for debugging purpose. The tags and keys appear in the order they are declared in the file. The columns are tag numerical code as anInteger, tag name as aStringand value as anObject.This method should not be invoked during normal operations; the standard metadata are preferred because they allow abstraction of data format details. Native metadata should be used only when an information does not appear in standard metadata, or for debugging purposes.
Performance note
Since this method should not be invoked in normal operations, it has not been tuned for performance. Invoking this method may cause a lot of seek operations.- Overrides:
getNativeMetadatain classDataStore- Returns:
- resources information structured in an implementation-specific way.
- Throws:
DataStoreException- if an error occurred while reading the metadata.- Since:
- 1.2
-
components
Returns descriptions of all images in this GeoTIFF file. Images are not immediately loaded.If an error occurs during iteration in the returned collection, an unchecked
BackingStoreExceptionwill be thrown with aDataStoreExceptionas its cause.- Specified by:
componentsin interfaceAggregate- Returns:
- descriptions of all images in this GeoTIFF file.
- Throws:
DataStoreException- if an error occurred while fetching the image descriptions.- Since:
- 1.0
-
findResource
Returns the image at the given index. Images numbering starts at 1. If the given string has a scope (e.g. "filename:1"), then the scope- Overrides:
findResourcein classDataStore- Parameters:
sequence- string representation of the image index, starting at 1.- Returns:
- image at the given index.
- Throws:
DataStoreException- if the requested image cannot be obtained.- See Also:
-
addListener
public <T extends StoreEvent> void addListener(Class<T> eventType, StoreListener<? super T> listener) Registers a listener to notify when the specified kind of event occurs in this data store. The current implementation of this data store can emit onlyWarningEvents; any listener specified for another kind of events will be ignored.- Specified by:
addListenerin interfaceResource- Overrides:
addListenerin classDataStore- Type Parameters:
T- compile-time value of theeventTypeargument.- Parameters:
eventType- type ofStoreEventto listen (cannot benull).listener- listener to notify about events.
-
close
Closes this GeoTIFF store and releases any underlying resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein classDataStore- Throws:
DataStoreException- if an error occurred while closing the GeoTIFF file.- See Also:
-