gws.base.legend.core

Source code: gws.base.legend.core

Module Contents

gws.base.legend.core.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.core.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.core.Object

Bases: gws.Legend

Generic legend object.

cacheMaxAge: int
options: dict
configure()

Configuration hook.

gws.base.legend.core.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.core.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.core.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.

class gws.base.legend.core.Props(*args, **kwargs)

Bases: gws.Props

Object properties.

type: str