Skip to main content
`Ctrl`+`K`

# 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 to `Catalog`, `Collection` and `Item`.

## Items

Representations of Items and related structures like Asset Objects.

- `pystac.Asset`: Represents an Asset Object

- `pystac.Item`: Represents an Item

- `pystac.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 of `pystac.SpatialExtent` and `pystac.TemporalExtent` instances.

- `pystac.Provider`: Represents a Provider Object. The `pystac.ProviderRole` enum provides common values used in the `"roles"` field.

- `pystac.Summaries`: Class for working with various types of CollectionSummaries

- `pystac.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/O

- `pystac.stac_io.DefaultStacIO`: The default `pystac.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:

- `Datacube`

- `Electro-Optical`

- `File Info`

- `Item Assets`

- `MGRS`

- `Point Cloud`

- `Projection`

- `Raster`

- `SAR`

- `Satellite`

- `Scientific Citation`

- `Table`

- `Timestamps`

- `Versioning Indicators`

- `View Geometry`

- `Xarray Assets`

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 in `pystac.Collection.summaries` to include properties defined by a STAC Extension.

- `pystac.extensions.base.PropertiesExtension`: Abstract base class for extending the properties of an `Item` 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 in `ExtensionHooks` 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 a `LayoutTemplate` 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 error

- `pystac.STACTypeError`: Raised when a representation of a STAC entity is encountered that is not correct for the context

- `pystac.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 or `None`.

- `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 for `LayoutTemplate`.

## Serialization

The `pystac.serialization` sub-package contains tools used internally by PySTAC to identify, serialize, and migrate STAC objects:

- `pystac.serialization`: Tools for identifying and migrating STAC objects

## 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 default `STACValidator` implementation used by PySTAC. Uses JSON schemas read from URIs provided by a `SchemaUriMap`, 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 a `JsonSchemaSTACValidator` to modify the URIs used.

- `pystac.validation.schema_uri_map.DefaultSchemaUriMap`: The default `SchemaUriMap` used by PySTAC.

## Internal Classes

These classes are used internally by PySTAC for caching.

- `pystac.cache.ResolvedObjectCache`