Open
Description
Its not uncommon to create Assets
before Items
, as many of the item properties (e.g. geometry
) can be derived from Assets
. This currently requires a strange dance, where you need to:
- Create assets
- Generate item attributes from those assets
- Create the item
- Add the assets to the item
- Add extensions to those assets
If we could extend assets before they are added to the item, this workflow could be simpler.
One possible solution
Assets
also have a stac_extensions
field that is excluded from its representative dictionary. This field is populated when the Asset
is created when reading an Item
, and propogated up to the Item
on, e.g., to_dict()
. This would allow something like (pseudo-python):
asset = Asset(href="my-cog.tif")
geometry, proj = read_proj_from_tif(asset.href) # example utility method that reads proj and geometry information from a tif
projection = ProjectionExtension.ext(asset, add_if_missing=True)
projection.update(**proj)
item = Item(geometry=geometry, ...) # omitting the rest
item.add_asset(asset)