pystac.extensions.item_assets#

Implements the Item Assets Definition Extension.

class pystac.extensions.item_assets.AssetDefinition(properties: dict[str, Any], owner: Collection | None = None)[source]#

Object that contains details about the datafiles that will be included in member Items for this Collection.

See the Asset Object for details.

apply(title: str | None, description: str | None, media_type: str | None, roles: list[str] | None, extra_fields: dict[str, Any] | None = None) None[source]#

Sets the properties for this asset definition.

Parameters:
  • title – Displayed title for clients and users.

  • description – Description of the Asset providing additional details, such as how it was processed or created. CommonMark 0.29 syntax MAY be used for rich text representation.

  • media_typemedia type of the asset.

  • rolessemantic roles of the asset, similar to the use of rel in links.

  • extra_fields – Additional fields on the asset definition, e.g. from extensions.

classmethod create(title: str | None, description: str | None, media_type: str | None, roles: list[str] | None, extra_fields: dict[str, Any] | None = None) AssetDefinition[source]#

Creates a new asset definition.

Parameters:
  • title – Displayed title for clients and users.

  • description – Description of the Asset providing additional details, such as how it was processed or created. CommonMark 0.29 syntax MAY be used for rich text representation.

  • media_typemedia type of the asset.

  • rolessemantic roles of the asset, similar to the use of rel in links.

  • extra_fields – Additional fields on the asset definition, e.g. from extensions.

create_asset(href: str) Asset[source]#

Creates a new Asset instance using the fields from this AssetDefinition and the given href.

property description: str | None#

Gets or sets a description of the Asset providing additional details, such as how it was processed or created. CommonMark 0.29 syntax MAY be used for rich text representation.

property ext: ItemAssetExt#

Accessor for extension classes on this item_asset

Example:

collection.ext.item_assets["data"].ext.proj.epsg = 4326
property media_type: str | None#

Gets or sets the media type of the asset.

owner: Collection | None#
properties: dict[str, Any]#
property roles: list[str] | None#

Gets or sets the semantic roles of the asset, similar to the use of rel in links.

set_owner(obj: Collection) None[source]#

Sets the owning item of this AssetDefinition.

The owning item will be used to resolve relative HREFs of this asset.

Parameters:

obj – The Collection that owns this asset.

property title: str | None#

Gets or sets the displayed title for clients and users.

to_dict() dict[str, Any][source]#

Returns a dictionary representing this AssetDefinition.

class pystac.extensions.item_assets.ItemAssetsExtension(collection: Collection)[source]#
collection: Collection#
classmethod ext(obj: Collection, add_if_missing: bool = False) ItemAssetsExtension[source]#

Extends the given Collection with properties from the Item Assets Extension.

Raises:

pystac.ExtensionTypeError – If an invalid object type is passed.

classmethod get_schema_uri() str[source]#

Gets the schema URI associated with this extension.

property item_assets: dict[str, AssetDefinition]#

Gets or sets a dictionary of assets that can be found in member Items. Maps the asset key to an AssetDefinition instance.

name: Literal['item_assets'] = 'item_assets'#
class pystac.extensions.item_assets.ItemAssetsExtensionHooks[source]#
migrate(obj: dict[str, Any], version: STACVersionID, info: STACJSONDescription) None[source]#

Migrate a STAC Object in dict format from a previous version. The base implementation will update the stac_extensions to the latest schema ID. This method will only be called for STAC objects that have been identified as a previous version of STAC. Implementations should directly manipulate the obj dict. Remember to call super() in order to change out the old ‘stac_extension’ entry with the latest schema URI.

prev_extension_ids = {'asset', 'item-assets'}#
schema_uri: str = 'https://stac-extensions.github.io/item-assets/v1.0.0/schema.json'#
stac_object_types = {Collection}#