gws.base.legend
¶
Source code: gws.base.legend
Submodules¶
Package Contents¶
- gws.base.legend.combine_outputs(lros: list[gws.LegendRenderOutput], options: dict = None) gws.LegendRenderOutput | None ¶
Combine multiple LegendRenderOutputs into a single output.
- Parameters:
lros – A list of legend render outputs to combine.
options – Optional combination settings (currently unused).
- Returns:
A new LegendRenderOutput containing the combined image, or None if no images were provided.
- class gws.base.legend.Config(*args, **kwargs)¶
Bases:
gws.ConfigWithAccess
Layer legend confuguration.
- cacheMaxAge: gws.Duration = '1d'¶
Max cache age for remote legends.
- options: dict | None¶
Provider-dependent legend options.
- class gws.base.legend.Object¶
Bases:
gws.Legend
Generic legend object.
- cacheMaxAge: int¶
- options: dict¶
- configure()¶
Configuration hook.
- gws.base.legend.output_to_bytes(lro: gws.LegendRenderOutput) bytes | None ¶
Convert a LegendRenderOutput to raw image bytes.
- Parameters:
lro – The legend render output object.
- Returns:
The image encoded as bytes if available, otherwise None.
- gws.base.legend.output_to_image(lro: gws.LegendRenderOutput) gws.Image | None ¶
Extract an image object from a LegendRenderOutput.
- Parameters:
lro – The legend render output object.
- Returns:
The image object if available, otherwise None (e.g. when only HTML is set).
- gws.base.legend.output_to_image_path(lro: gws.LegendRenderOutput) str | None ¶
Resolve the file path to the image of a LegendRenderOutput.
- Parameters:
lro – The legend render output object.
- Returns:
Path to the image file if available, otherwise None.