Skip to content

Commit a0f70e5

Browse files
committed
FIX: Add a fallback in case of impossibleness of reading ICEYE QUICKLOOK.kml file
1 parent ef3b3ff commit a0f70e5

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- FIX: Fix WV Legion wrong band order in Multi Spectral 1 mode [#246](https://github.com/sertit/eoreader/issues/246)
1010
- FIX: Collocate Planet spectral bands with masks for some rare cases where it fails
1111
- FIX: Loosen the constraints on PlanetScope stack name as it may change, from `Analytic` to `composite`, etc. [#244](https://github.com/sertit/eoreader/issues/244)
12+
- FIX: Add a fallback in case of impossibleness of reading ICEYE `QUICKLOOK.kml` file
1213

1314
## 0.22.4 (2025-07-07)
1415

eoreader/products/sar/iceye_product.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from sertit import path, vectors
3030
from sertit.misc import ListEnum
3131
from sertit.types import AnyPathStrType
32+
from shapely import Polygon
3233

3334
from eoreader import DATETIME_FMT, EOREADER_NAME, cache
3435
from eoreader.bands import SarBandNames as sab
@@ -179,7 +180,30 @@ def wgs84_extent(self) -> gpd.GeoDataFrame:
179180
# Some ICEYE products don't have any QUICKLOOK.kml file as it is not a mandatory file!
180181
extent_wgs84 = self._fallback_wgs84_extent("QUICKLOOK.kml")
181182

182-
return gpd.GeoDataFrame(geometry=extent_wgs84.geometry, crs=extent_wgs84.crs)
183+
# Other fallback
184+
if extent_wgs84.crs is None:
185+
root, nsmap = self.read_mtd()
186+
187+
# Some ICEYE product metadata has a namespace some don't
188+
namespace = nsmap.get(None, "")
189+
190+
# Get lat lon of extent coordinates
191+
fn = root.findtext(f".//{namespace}coord_first_near").split(" ")[2:]
192+
ln = root.findtext(f".//{namespace}coord_last_near").split(" ")[2:]
193+
lf = root.findtext(f".//{namespace}coord_last_far").split(" ")[2:]
194+
ff = root.findtext(f".//{namespace}coord_first_far").split(" ")[2:]
195+
196+
extent_wgs84 = gpd.GeoDataFrame(
197+
geometry=[Polygon([fn[::-1], ln[::-1], lf[::-1], ff[::-1]])],
198+
crs=vectors.WGS84,
199+
).envelope
200+
201+
# Drop all columns except important ones
202+
extent_wgs84 = gpd.GeoDataFrame(
203+
geometry=extent_wgs84.geometry, crs=extent_wgs84.crs
204+
)
205+
206+
return extent_wgs84
183207

184208
def _set_product_type(self) -> None:
185209
"""Set products type"""

0 commit comments

Comments
 (0)