ITADN

Proper handling of root relative hrefs

#1597Closedsoxofaan 创建于 2025-12-04
enhancement
S
soxofaancommented
We're struggling with a use case where items have "root relative" hrefs to assets and pystac does not provide a valid absolute href: ``` >>> import pystac >>> pystac.__version__ '1.14.1' >>> item = pystac.read_file("https://eoresults.esa.int/stac/collections/FCM-AGB-100m/items/FCM-AGB-100m-2017") >>> asset = item.assets["PRODUCT"] >>> asset.href '/d/FCM-AGB-100m/2017/01/01/FCM-AGB-100m-2017/FCM_Europe_demo_2017_AGB.tif' >>> asset.get_absolute_href() '/d/FCM-AGB-100m/2017/01/01/FCM-AGB-100m-2017/FCM_Europe_demo_2017_AGB.tif' ``` The expectation is to get absolute href `https://eoresults.esa.int/d/FCM-AGB-100m/2017/01/01/FCM-AGB-100m-2017/FCM_Europe_demo_2017_AGB.tif` Relevant parts of item STAC: ``` { "id": "FCM-AGB-100m-2017", "type": "Feature", "links": [ { "rel": "root", "type": "application/json", "href": "https://eoresults.esa.int/stac/" }, { "rel": "self", "type": "application/geo+json", "href": "https://eoresults.esa.int/stac/collections/FCM-AGB-100m/items/FCM-AGB-100m-2017" } ], "assets": { "PRODUCT": { "href": "/d/FCM-AGB-100m/2017/01/01/FCM-AGB-100m-2017/FCM_Europe_demo_2017_AGB.tif", "type": "image/tiff; application=geotiff", "roles": ["data"], "title": "Product", } }, ``` note: STAC browser does produce the expected asset href: https://radiantearth.github.io/stac-browser/#/external/eoresults.esa.int/stac/collections/FCM-AGB-100m/items/FCM-AGB-100m-2017
关闭于 2025-12-12 3 条评论