Metadata Readers¶
geoembed.metadata.readers
¶
Metadata readers — extract spatial and temporal information from imagery files.
Follows Single Responsibility Principle (SRP): each reader handles one data source.
MetadataReader
¶
Bases: ABC
Abstract interface for file metadata readers.
read(file_path)
abstractmethod
¶
Extract metadata from a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
Path
|
Path to the file to read. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary of extracted metadata fields. |
XmlSidecarReader()
¶
Bases: MetadataReader
Extracts temporal and provider metadata from ISO 19115 XML sidecars.
Parses XML metadata files (.xml) that accompany GeoTIFFs to extract: - Capture datetime (from EX_TemporalExtent) - EPSG code (from referenceSystemIdentifier) - Provider/organisation name (from CI_ResponsibleParty)
Source code in src/geoembed/metadata/readers.py
read(file_path)
¶
Read metadata from the XML sidecar accompanying a GeoTIFF.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
Path
|
Path to the GeoTIFF (XML is assumed to be at same path with .xml extension). |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dict with keys: xml_path, datetime, epsg, provider. Empty dict if no XML found. |
Source code in src/geoembed/metadata/readers.py
GeotiffSpatialReader
¶
Bases: MetadataReader
Extracts spatial bounds and geometry from GeoTIFF headers.
Uses rasterio to read CRS and bounds without loading pixel data. Returns native-CRS bounds (not reprojected).
read(file_path)
¶
Read spatial metadata from a GeoTIFF.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
Path
|
Path to the GeoTIFF. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dict with keys: bbox (list[float]), footprint (GeoJSON), epsg (int|None). |