API Reference#
This API reference is auto-generated from the Python docstrings. The table of contents on the left is organized by module. The sections below are organized based on concepts and sections within the STAC Spec and PySTAC itself.
Base Structures & Classes#
These are the core Python classes representing entities within the STAC Spec. These classes provide convenient methods for serializing and deserializing from JSON, extracting properties, and creating relationships between entities.
pystac.Link
: Represents a Link Object.pystac.MediaType
: Provides common values used in the Link and Asset"type"
fields.pystac.RelType
: Provides common values used in the Link"rel"
field.pystac.STACObject
: Base class implementing functionality common toCatalog
,Collection
andItem
.
Items#
Representations of Items and related structures like Asset Objects.
pystac.Asset
: Represents an Asset Objectpystac.Item
: Represents an Itempystac.CommonMetadata
: A container for fields defined in the Common Metadata section of the spec. These fields are commonly found in STAC Item properties, but may be found elsewhere.
Collections#
These are representations of Collections and related structures.
pystac.Collection
: Represents a Collection.pystac.Extent
: Represents an Extent Object, which is composed ofpystac.SpatialExtent
andpystac.TemporalExtent
instances.pystac.Provider
: Represents a Provider Object. Thepystac.ProviderRole
enum provides common values used in the"roles"
field.pystac.Summaries
: Class for working with various types of CollectionSummariespystac.ItemCollection
: Represents a GeoJSON FeatureCollection in which all Features are STAC Items.
Catalogs#
Representations of Catalogs and related structures.
pystac.Catalog
: Represents a Catalog.pystac.CatalogType
: Enum representing the common types of Catalogs described in the STAC Best Practices
I/O#
These classes are used to read and write files from disk or over the network, as well as to serialize and deserialize STAC object to and from JSON.
pystac.StacIO
: Base class that can be inherited to provide custom I/Opystac.stac_io.DefaultStacIO
: The defaultpystac.StacIO
implementation used throughout the library.
Client#
A convenience method for accessing pystac-client
Example:
from pystac.client import Client
Extensions#
PySTAC provides support for the following STAC Extensions:
The following classes are used internally to implement these extensions and may be used to create custom implementations of STAC Extensions not supported by the library (see Adding New and Custom Extensions for details):
pystac.extensions.base.SummariesExtension
: Base class for extending the properties inpystac.Collection.summaries
to include properties defined by a STAC Extension.pystac.extensions.base.PropertiesExtension
: Abstract base class for extending the properties of anItem
to include properties defined by a STAC Extension.pystac.extensions.base.ExtensionManagementMixin
: Abstract base class with methods for adding and removing extensions from STAC Objects.pystac.extensions.hooks.ExtensionHooks
: Used to implement hooks when extending a STAC Object. Primarily used to implement migrations from one extension version to another.pystac.extensions.hooks.RegisteredExtensionHooks
: Used to register hooks defined inExtensionHooks
instances to ensure they are used in object deserialization.
Catalog Layout#
These classes are used to set the HREFs of a STAC according to some layout. The templating functionality is also used when generating subcatalogs based on a template.
pystac.layout.LayoutTemplate
: Represents a template that can be used for deriving paths or other information based on properties of STAC objects supplied as a template string.pystac.layout.BestPracticesLayoutStrategy
: Layout strategy that represents the catalog layout described in the STAC Best Practices documentation.pystac.layout.APILayoutStrategy
: Layout strategy that represents the catalog layout described in the STAC API documentation.pystac.layout.TemplateLayoutStrategy
: Layout strategy that can take strings to be supplied to aLayoutTemplate
to derive paths.pystac.layout.CustomLayoutStrategy
: Layout strategy that allows users to supply functions to dictate stac object paths.
Errors#
The following exceptions may be raised internally by the library.
pystac.STACError
: Generic STAC-related errorpystac.STACTypeError
: Raised when a representation of a STAC entity is encountered that is not correct for the contextpystac.DuplicateObjectKeyError
: Raised when deserializing a JSON object containing a duplicate key.pystac.ExtensionAlreadyExistsError
: Raised when deserializing a JSON object containing a duplicate key.pystac.ExtensionTypeError
: Raised when an extension is used against an object to which that the extension does not apply to.pystac.ExtensionNotImplemented
: Raised on an attempt to extend a STAC object that does not implement the given extension.pystac.RequiredPropertyMissing
: Raised when a required value is expected to be present but is missing orNone
.pystac.STACValidationError
: Raised by validation calls if the STAC JSON is invalid.pystac.TemplateError
: Raised when an error occurs while converting a template string into data forLayoutTemplate
.
Serialization#
The pystac.serialization
sub-package contains tools used internally by PySTAC to
identify, serialize, and migrate STAC objects:
pystac.serialization.identify
: Tools for identifying STAC objectspystac.serialization.migrate
: Tools for migrating STAC objects from a previous STAC Spec version.
Validation#
Note
The tools described here require that you install PySTAC with the validation
extra (see the documentation on installing dependencies for details).
PySTAC includes a pystac.validation
package for validating STAC objects, including
from PySTAC objects and directly from JSON.
pystac.validation.stac_validator.STACValidator
: Abstract base class defining methods for validating STAC JSON. Implementations define methods for validating core objects and extension.pystac.validation.stac_validator.JsonSchemaSTACValidator
: The defaultSTACValidator
implementation used by PySTAC. Uses JSON schemas read from URIs provided by aSchemaUriMap
, to validate STAC objects.pystac.validation.schema_uri_map.SchemaUriMap
: Defines methods for mapping STAC versions, object types and extension ids to schema URIs. A default implementation is included that uses known locations; however users can provide their own schema URI maps in aJsonSchemaSTACValidator
to modify the URIs used.pystac.validation.schema_uri_map.DefaultSchemaUriMap
: The defaultSchemaUriMap
used by PySTAC.
Internal Classes#
These classes are used internally by PySTAC for caching.