... | ... | @@ -122,43 +122,41 @@ Here is a new workflow to replace the current function |
|
|
|
|
|
![image](uploads/1c06ec00864af716582714cfe7563345/image.png)
|
|
|
|
|
|
1. Reading the metadata files. The purpose of this step is to parse
|
|
|
each metadata file associated with the image file and supply it as
|
|
|
a (in-memory) XML tree. This tree is given to a
|
|
|
ImageMetadataInterface (IMI) that will look for needed
|
|
|
information. The parsing is be done by different classes,
|
|
|
depending on the file format. They can all derive from the base
|
|
|
class MetadataSupplierInterface. The three suppliers are:
|
|
|
* GDALImageIO will use GDALDataset::GetMetadata() to extract
|
|
|
'key=value' pairs and format them into a XML tree.
|
|
|
* XMLMetadataSupplier uses GDAL's XML parsing mechanism
|
|
|
("ReadXMLToList" method from the "GDALMDReaderBase" class) to
|
|
|
convert the XML file into a GDAL ListString, which is a
|
|
|
succession of 'key=value' pairs.
|
|
|
* TextMetadataSupplier tries to parse 'key=value' pairs.
|
|
|
|
|
|
Those classes all implement the method *GetMetadataValue* which
|
|
|
returns the value of the metadata from a given key. The base class
|
|
|
also implements the methods *GetAs* and *GetAsVector* which are
|
|
|
used by the IMI.
|
|
|
|
|
|
1. The GDAL input/output capabilities are encapsulated in the
|
|
|
- The GDAL input/output capabilities are encapsulated in the
|
|
|
GDALImageIO class, which derivates from ImageIO. This class is in
|
|
|
charge of fetching the metadata from the product (supplier
|
|
|
capabilities inherited from the class MetadataSupplierInterface),
|
|
|
and of writing the metadata to the product (storage capabilities
|
|
|
capabilities inherited from the class MetadataSupplierInterface)
|
|
|
and storing them in memory as a keywordlist. It is also in charge
|
|
|
of writing the metadata to the product (storage capabilities
|
|
|
inherited from the class MetadataStorageInterface).
|
|
|
|
|
|
1. We use a classic IMIFactory to find if a given IMI (associated to a
|
|
|
given sensor) can parse the metadata of a product. The IMI's
|
|
|
- An ImageMetadataInterface (IMI) is then called to parse the
|
|
|
metadata. There is one IMI per sensor. We use a classical Factory
|
|
|
to find which one can parse the metadata of a product. The IMI's
|
|
|
*parse* method will pick the metadata from the ImageIO and fill an
|
|
|
*ImageMetadata* object. This step consists in finding the relevant
|
|
|
metadata in the different Metadata Suppliers and using the *Add()*
|
|
|
method of the *ImageMetadata* object to store the metadata. If the
|
|
|
parsing returns successfully, the generated ImageMetadata is given
|
|
|
to the *ImageCommon* that propagate through the pipeline.
|
|
|
*ImageMetadata* object.
|
|
|
|
|
|
- Some metadata are not read by GDAL. To parse those metadata, the
|
|
|
IMI can call other suppliers, depending on the file format:
|
|
|
* to parse XML files, XMLMetadataSupplier uses GDAL's XML parsing
|
|
|
mechanism ("ReadXMLToList" method from the "GDALMDReaderBase"
|
|
|
class) to convert the XML file into a GDAL ListString, which is a
|
|
|
succession of 'key=value' pairs.
|
|
|
* to parse text files, TextMetadataSupplier tries to parse
|
|
|
'key=value' pairs.
|
|
|
|
|
|
Other suppliers can be added if needed. Those classes (including
|
|
|
GDALImageIO) all implement the method *GetMetadataValue* which
|
|
|
returns the value of the metadata from a given key. The base class
|
|
|
also implements the methods *GetAs* and *GetAsVector* which are
|
|
|
used by the IMI.
|
|
|
|
|
|
- The IMI finds the relevant metadata in the different Metadata
|
|
|
Suppliers and use the *Add()* method of the *ImageMetadata* object
|
|
|
to store the metadata. If the parsing returns successfully, the
|
|
|
generated ImageMetadata is given to the *ImageCommon* that
|
|
|
propagate through the pipeline.
|
|
|
|
|
|
## Justifications for the technical choices
|
|
|
|
|
|
### Refactor OTB Metadata
|
... | ... | |