pytac.extensions.base#
- class pystac.extensions.base.ExtensionManagementMixin(*args, **kwds)[source]#
Bases:
Generic
[pystac.extensions.base.S
],abc.ABC
Abstract base class with methods for adding and removing extensions from STAC Objects. This class is generic over the type of object being extended (e.g.
Item
).Concrete extension implementations should inherit from this class and either provide a concrete type or a bounded type variable.
See
EOExtension
for an example implementation.- classmethod add_to(obj: pystac.extensions.base.S) None [source]#
Add the schema URI for this extension to the
stac_extensions
list for the given object, if it is not already present.
- abstract classmethod get_schema_uri() str [source]#
Gets the schema URI associated with this extension.
- classmethod has_extension(obj: pystac.extensions.base.S) bool [source]#
Check if the given object implements this extension by checking
pystac.STACObject.stac_extensions
for this extension’s schema URI.
- classmethod remove_from(obj: pystac.extensions.base.S) None [source]#
Remove the schema URI for this extension from the
pystac.STACObject.stac_extensions
list for the given object.
- classmethod validate_has_extension(obj: pystac.extensions.base.S, add_if_missing: bool) None [source]#
Given a
STACObject
, checks if the object has this extension’s schema URI in itsstac_extensions
list. Ifadd_if_missing
isTrue
, the schema URI will be added to the object.- Parameters
obj – The object to validate.
add_if_missing – Whether to add the schema URI to the object if it is not already present.
- classmethod validate_owner_has_extension(asset: pystac.asset.Asset, add_if_missing: bool) None [source]#
Given an
Asset
, checks if the asset’s owner has this extension’s schema URI in itsstac_extensions
list. Ifadd_if_missing
isTrue
, the schema URI will be added to the owner.- Raises
STACError – If
add_if_missing
isTrue
andasset.owner
isNone
.
- class pystac.extensions.base.PropertiesExtension[source]#
Bases:
abc.ABC
Abstract base class for extending the properties of an
Item
to include properties defined by a STAC Extension.This class should not be instantiated directly. Instead, create an extension-specific class that inherits from this class and instantiate that. See
PropertiesEOExtension
for an example.- additional_read_properties: Optional[Iterable[Dict[str, Any]]] = None#
Additional read-only properties accessible from the extended object.
These are used when extending an
Asset
to give access to the properties of the owningItem
. If a property exists in bothadditional_read_properties
andproperties
, the value inadditional_read_properties
will take precedence.
- class pystac.extensions.base.SummariesExtension(collection: pystac.collection.Collection)[source]#
Bases:
object
Base class for extending the properties in
pystac.Collection.summaries
to include properties defined by a STAC Extension.This class should generally not be instantiated directly. Instead, create an extension-specific class that inherits from this class and instantiate that. See
SummariesEOExtension
for an example.- summaries: pystac.summaries.Summaries#
The summaries for the
Collection
being extended.