Class LandsatStore
-
- All Implemented Interfaces:
AutoCloseable,Resource,Localized
public class LandsatStore extends DataStore
Parses Landsat metadata as ISO 19115 Metadata object. Landsat data are distributed as a collection of TIFF files, together with a single text file like below:
This class reads the content from the given input until the first occurrence of theGROUP = L1_METADATA_FILE GROUP = METADATA_FILE_INFO ORIGIN = "Image courtesy of the U.S. Geological Survey" REQUEST_ID = "0501403126384_00011" LANDSAT_SCENE_ID = "LC81230522014071LGN00" FILE_DATE = 2014-03-12T06:06:35Z STATION_ID = "LGN" PROCESSING_SOFTWARE_VERSION = "LPGS_2.3.0" END_GROUP = METADATA_FILE_INFO GROUP = PRODUCT_METADATA DATA_TYPE = "L1T" ELEVATION_SOURCE = "GLS2000" OUTPUT_FORMAT = "GEOTIFF" SPACECRAFT_ID = "LANDSAT_8" SENSOR_ID = "OLI_TIRS" etc...ENDkeyword. Lines beginning with the#character (ignoring spaces) are treated as comment lines and ignored.- Since:
- 0.8
Defined in the
sis-earth-observationmodule
-
-
Constructor Summary
Constructors Constructor Description LandsatStore(LandsatStoreProvider provider, StorageConnector connector)Creates a new Landsat store from the given file, URL, stream or character reader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <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 Landsat store and releases any underlying resources.Optional<GenericName>getIdentifier()Returns the value associated toLANDSAT_SCENE_IDin the Landsat metadata file.MetadatagetMetadata()Returns information about the dataset as a whole.Optional<ParameterValueGroup>getOpenParameters()Returns the parameters used to open this Landsat data store.-
Methods inherited from class DataStore
addWarningListener, findResource, getDisplayName, getLocale, getProvider, removeListener, removeWarningListener, setLocale, toString
-
-
-
-
Constructor Detail
-
LandsatStore
public LandsatStore(LandsatStoreProvider provider, StorageConnector connector) throws DataStoreException
Creates a new Landsat store from the given file, URL, stream or character reader. 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, reader instance, etc).- Throws:
DataStoreException- if an error occurred while opening the Landsat file.
-
-
Method Detail
-
getOpenParameters
public Optional<ParameterValueGroup> getOpenParameters()
Returns the parameters used to open this Landsat data store. The parameters are described byLandsatStoreProvider.getOpenParameters()and contains at least a parameter named "location" with aURIvalue. The return value may be empty if the storage input can not be described by a URI (for example a Landsat file reading directly from aReadableByteChannel).- Specified by:
getOpenParametersin classDataStore- Returns:
- parameters used for opening this data store.
- Since:
- 0.8
- See Also:
DataStoreProvider.getOpenParameters()
-
getIdentifier
public Optional<GenericName> getIdentifier() throws DataStoreException
Returns the value associated toLANDSAT_SCENE_IDin the Landsat metadata file. This value is fetched fromgetMetadata()/identificationInfo/citation/identifier.- Specified by:
getIdentifierin interfaceResource- Overrides:
getIdentifierin classDataStore- Returns:
- the identifier fetched from metadata, or
nullif none. - Throws:
DataStoreException- if an error occurred while reading the metadata.- Since:
- 1.0
- See Also:
DataStore.getMetadata(),DataStore.getDisplayName()
-
getMetadata
public Metadata getMetadata() throws DataStoreException
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 metadata.- See Also:
DataStore.getIdentifier()
-
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 (can not benull).listener- listener to notify about events.
-
close
public void close() throws DataStoreExceptionCloses this Landsat store and releases any underlying resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein classDataStore- Throws:
DataStoreException- if an error occurred while closing the Landsat file.
-
-