pystac.asset#

class pystac.asset.Asset(href: str, title: Optional[str] = None, description: Optional[str] = None, media_type: Optional[str] = None, roles: Optional[List[str]] = None, extra_fields: Optional[Dict[str, Any]] = None)[source]

An object that contains a link to data associated with an Item or Collection that can be downloaded or streamed.

Parameters
  • href – Link to the asset object. Relative and absolute links are both allowed.

  • title – Optional displayed title for clients and users.

  • description – 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.

  • media_type – Optional description of the media type. Registered Media Types are preferred. See MediaType for common media types.

  • roles – Optional, Semantic roles (i.e. thumbnail, overview, data, metadata) of the asset.

  • extra_fields – Optional, additional fields for this asset. This is used by extensions as a way to serialize and deserialize properties on asset object JSON.

clone() pystac.asset.Asset[source]

Clones this asset. Makes a deepcopy of the extra_fields.

Returns

The clone of this asset.

Return type

Asset

property common_metadata: CommonMetadata_Type

Access the asset’s common metadata fields as a CommonMetadata object.

description: Optional[str]

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.

extra_fields: Dict[str, Any]

Optional, additional fields for this asset. This is used by extensions as a way to serialize and deserialize properties on asset object JSON.

classmethod from_dict(d: Dict[str, Any]) pystac.asset.Asset[source]

Constructs an Asset from a dict.

Returns

The Asset deserialized from the JSON dict.

Return type

Asset

get_absolute_href() Optional[str][source]

Gets the absolute href for this asset, if possible.

If this Asset has no associated Item, and the asset HREF is a relative path,

this method will return None. If the Item that owns the Asset has no self HREF, this will also return None.

Returns

The absolute HREF of this asset, or None if an absolute HREF could not

be determined.

Return type

str

href: str

Link to the asset object. Relative and absolute links are both allowed.

media_type: Optional[str]

Optional description of the media type. Registered Media Types are preferred. See MediaType for common media types.

owner: Optional[Union[Item_Type, Collection_Type]]

The Item or Collection that this asset belongs to, or None if it has no owner.

roles: Optional[List[str]]

Optional, Semantic roles (i.e. thumbnail, overview, data, metadata) of the asset.

set_owner(obj: Union[Collection_Type, Item_Type]) None[source]

Sets the owning item of this Asset.

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

Parameters

obj – The Collection or Item that owns this asset.

title: Optional[str]

Optional displayed title for clients and users.

to_dict() Dict[str, Any][source]

Generate a dictionary representing the JSON of this Asset.

Returns

A serialization of the Asset that can be written out as JSON.

Return type

dict