Skip to content

Commit 3d8e0e5

Browse files
Merge pull request #1731 from Open-EO/consider_cloud_optimized_geotiff_as_data
Consider cloud optimized geotiff as data.
2 parents 7833832 + 75706f8 commit 3d8e0e5

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

openeogeotrellis/load_stac.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1951,13 +1951,17 @@ def _is_band_asset(asset: pystac.Asset) -> bool:
19511951
# but implementation also seems to be happy with just being loadable as raster data in some sense.
19521952

19531953
# Skip unsupported media types (if known)
1954-
if asset.media_type and not _is_supported_raster_mime_type(asset.media_type):
1955-
return False
1954+
if asset.media_type:
1955+
if asset.media_type == "image/vnd.stac.geotiff; cloud-optimized=true":
1956+
return True
1957+
if not _is_supported_raster_mime_type(asset.media_type):
1958+
return False
19561959

19571960
# Decide based on role (if known)
19581961
if asset.roles is None:
19591962
pass
19601963
elif len(asset.roles) > 0:
1964+
# https://github.com/radiantearth/stac-spec/blob/master/best-practices.md#list-of-asset-roles
19611965
roles_with_bands = {
19621966
"data",
19631967
"data-mask",

tests/test_load_stac.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,7 @@ def test_is_supported_raster_mime_type():
848848
({"href": "https://stac.test/asset.tif", "roles": ["data"]}, True),
849849
({"href": "https://stac.test/asset.tif", "roles": ["data"], "type": "image/tiff; application=geotiff"}, True),
850850
({"href": "https://stac.test/asset.tif", "type": "image/tiff; application=geotiff"}, False),
851+
({"href": "https://stac.test/asset.tif", "type": "image/vnd.stac.geotiff; cloud-optimized=true"}, True),
851852
({"href": "https://stac.test/asset.html", "roles": ["data"], "type": "text/html"}, False),
852853
({"href": "https://stac.test/asset.png", "roles": ["thumbnail"]}, False),
853854
({"href": "https://stac.test/asset.png", "bands": [{"name": "B02"}]}, True),

0 commit comments

Comments
 (0)