Skip to main content
`Ctrl`+`K`

# pystac.extensions.render

Implements the Render Extension.

class pystac.extensions.render.CollectionRenderExtension(collection: Collection)

  A concrete implementation of `RenderExtension` on a `Collection` that extends the properties of the Collection to include properties defined in the Render Extension.

  This class should generally not be instantiated directly. Instead, call `RenderExtension.ext()` on an `Collection` to extend it.

class pystac.extensions.render.ItemRenderExtension(item: Item)

  A concrete implementation of `RenderExtension` on a `Item` that extends the properties of the Item to include properties defined in the Render Extension.

  This class should generally not be instantiated directly. Instead, call `RenderExtension.ext()` on an `Item` to extend it.

class pystac.extensions.render.Render(properties: dict[str, Any])

  Parameters for creating a rendered view of assets.

  apply(assets: list[str], title: str | None = None, rescale: list[list[float]] | None = None, nodata: float | str | None = None, colormap_name: str | None = None, colormap: dict[str, Any] | None = None, color_formula: str | None = None, resampling: str | None = None, expression: str | None = None, minmax_zoom: list[int] | None = None) → None

    Set the properties for a new Render.

    Parameters:

      - assets – List of asset keys referencing the assets that are used to make the rendering.

      - title – Title of the rendering.

      - rescale – A list of min/max value pairs to rescale each asset by, e.g. `[[0, 5000], [0, 7000], [0, 9000]]`. If not provided, the assets will not be rescaled.

      - nodata – Nodata value.

      - colormap_name – Name of color map to apply to the render. https://matplotlib.org/stable/gallery/color/colormap_reference.html

      - colormap – A dictionary containing a custom colormap definition. https://developmentseed.org/titiler/advanced/rendering/#custom-colormaps

      - color_formula – A string containing a color formula to apply color corrections to images. Useful for reducing artifacts like atmospheric haze, dark shadows, or muted colors. https://developmentseed.org/titiler/advanced/rendering/#color-formula

      - resampling – Resampling algorithm to apply to the referenced assets. See GDAL resampling algorithm for some examples. https://gdal.org/en/latest/programs/gdalwarp.html#cmdoption-gdalwarp-r

      - expression – Band arithmetic formula to apply to the referenced assets.

      - minmax_zoom – Zoom level range applicable for the visualization, e.g. `[2, 18]`.

  property assets: list[str]

    List of asset keys referencing the assets that are used to make the rendering.

  property color_formula: str | None

    A string containing a color formula to apply color corrections to images. Useful for reducing artefacts like atmospheric haze, dark shadows, or muted colors. See: https://developmentseed.org/titiler/advanced/rendering/#color-formula

  property colormap: dict[str, Any] | None

    A dictionary containing a custom colormap definition. See: https://developmentseed.org/titiler/advanced/rendering/#custom-colormaps

  property colormap_name: str | None

    Name of color map to apply to the render. See: https://matplotlib.org/stable/gallery/color/colormap_reference.html

  classmethod create(assets: list[str], title: str | None = None, rescale: list[list[float]] | None = None, nodata: float | str | None = None, colormap_name: str | None = None, colormap: dict[str, Any] | None = None, color_formula: str | None = None, resampling: str | None = None, expression: str | None = None, minmax_zoom: list[int] | None = None) → Render

    Create a new Render.

    Parameters:

      - assets – List of asset keys referencing the assets that are used to make the rendering.

      - title – Title of the rendering.

      - rescale – A list of min/max value pairs to rescale each asset by, e.g. `[[0, 5000], [0, 7000], [0, 9000]]`. If not provided, the assets will not be rescaled.

      - nodata – Nodata value.

      - colormap_name – Name of color map to apply to the render. https://matplotlib.org/stable/gallery/color/colormap_reference.html

      - colormap – A dictionary containing a custom colormap definition. https://developmentseed.org/titiler/advanced/rendering/#custom-colormaps

      - color_formula – A string containing a color formula to apply color corrections to images. Useful for reducing artifacts like atmospheric haze, dark shadows, or muted colors. https://developmentseed.org/titiler/advanced/rendering/#color-formula

      - resampling – Resampling algorithm to apply to the referenced assets. See GDAL resampling algorithm for some examples. https://gdal.org/en/latest/programs/gdalwarp.html#cmdoption-gdalwarp-r

      - expression – Band arithmetic formula to apply to the referenced assets.

      - minmax_zoom – Zoom level range applicable for the visualization, e.g. `[2, 18]`.

  property expression: str | None

    Band arithmetic formula to apply to the referenced assets.

  property minmax_zoom: list[int] | None

    Zoom level range applicable for the visualization, e.g. `[2, 18]`.

  property nodata: float | str | None

    Nodata value.

  properties: dict[str, Any]
  property resampling: str | None

    Resampling algorithm to apply to the referenced assets. See GDAL resampling algorithm for some examples. See: https://gdal.org/en/latest/programs/gdalwarp.html#cmdoption-gdalwarp-r

  property rescale: list[list[float]] | None

    A list of min/max value pairs to rescale each asset by, e.g. `[[0, 5000], [0, 7000], [0, 9000]]`. If not provided, the assets will not be rescaled.

  property title: str | None

    Title of the rendering

  to_dict() → dict[str, Any]

class pystac.extensions.render.RenderExtension

  An abstract class that can be used to extend the properties of a `Collection` or `Item` with properties from the Render Extension. This class is generic over the type of STAC Object to be extended (e.g. `Item`, `Collection`).

  To create a concrete instance of `RenderExtension`, use the `RenderExtension.ext()` method. For example:

      >>> item: pystac.Item = ...
      >>> xr_ext = RenderExtension.ext(item)

  apply(renders: dict[str, Render]) → None

    Applies the render extension fields to the extended object.

    Parameters:

      renders – a dictionary mapping render names to :class: ~pystac.extensions.render.Render objects.

  classmethod ext(obj: T, add_if_missing: bool = False) → RenderExtension[T]

    Extend the given STAC Object with properties from the Render Extension.

    This extension can be applied to instances of `Collection` or `Item`.

    Raises:

      pystac.ExtensionTypeError – If an invalid object type is passed.

  classmethod get_schema_uri() → str

    Gets the schema URI associated with this extension.

  name: Literal['render'] = 'render'
  property renders: dict[str, Render]

    A dictionary where each key is the name of a render and each value is a `Render` object.

class pystac.extensions.render.RenderExtensionHooks
  schema_uri: str = 'https://stac-extensions.github.io/render/v2.0.0/schema.json'
  stac_object_types = {'Collection', 'Feature'}

class pystac.extensions.render.T

  Generalized version of `Collection` or `Item`

  alias of TypeVar(‘T’, ~pystac.collection.Collection, ~pystac.item.Item)