Skip to content

ItemCollection.to_xarray() fails when loading Item Collection from file

When loading an item collection from file, to_xarray leads to an error:

from simplestac.utils import ItemCollection

col = ItemCollection.from_file(col_file)
col.to_xarray()
# ValueError: Cannot pick a common CRS, since asset 'AOT' of item 0 'S2A_MSIL2A_20220120T105351_R051_T31UFQ_20220121T110346' does not have one.
# Please specify a CRS with the `epsg=` argument.

This issue comes from the fact that pystac >= 1.12 pops systematically the field proj:epsg when migrating to latest projection extension (2.0.0).

But in the case of an item with projection extension 1.2.0 it does not update the extension schema uri to 2.0.0 ...

Edited by DE BOISSIEU FLORIAN