pystac.item_assets#

Implements the Item Asset Definition Object for use as values in the item_assets dict.

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

Implementation of the Item Asset Definition Object for use as values in the item_assets dict.

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) ItemAssetDefinition[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 ItemAssetDefinition 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.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 ItemAssetDefinition.

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 ItemAssetDefinition.