Skip to content

Allow extensions for un-parented assets #793

Open
@gadomski

Description

@gadomski

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:

  1. Create assets
  2. Generate item attributes from those assets
  3. Create the item
  4. Add the assets to the item
  5. 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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions