pystac.extensions.render#
Implements the Render Extension.
- class pystac.extensions.render.CollectionRenderExtension(collection: Collection)[source]#
A concrete implementation of
RenderExtension
on aCollection
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 anCollection
to extend it.
- class pystac.extensions.render.ItemRenderExtension(item: Item)[source]#
A concrete implementation of
RenderExtension
on aItem
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 anItem
to extend it.
- class pystac.extensions.render.Render(properties: dict[str, Any])[source]#
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 [source]#
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 [source]#
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 minmax_zoom: list[int] | None#
Zoom level range applicable for the visualization, e.g.
[2, 18]
.
- 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
- class pystac.extensions.render.RenderExtension[source]#
An abstract class that can be used to extend the properties of a
Collection
orItem
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 theRenderExtension.ext()
method. For example:>>> item: pystac.Item = ... >>> xr_ext = RenderExtension.ext(item)
- apply(renders: dict[str, Render]) None [source]#
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] [source]#
Extend the given STAC Object with properties from the Render Extension.
This extension can be applied to instances of
Collection
orItem
.- Raises:
pystac.ExtensionTypeError – If an invalid object type is passed.
- name: Literal['render'] = 'render'#
- class pystac.extensions.render.RenderExtensionHooks[source]#
-
- stac_object_types = {'Collection', 'Feature'}#
- class pystac.extensions.render.T#
Generalized version of
Collection
orItem
alias of TypeVar(‘T’, ~pystac.collection.Collection, ~pystac.item.Item)