Skip to content

legends

Built-in legend presets for geolibre.Map.add_legend.

Each preset is a list of (label, color) pairs in display order, mirroring the land-cover legends shipped by leafmap/geemap so the embedded Legend control can render a recognizable legend (e.g. NLCD, ESA WorldCover) from a single name.

builtin_legend_names

builtin_legend_names() -> list[str]

Return the available built-in legend preset names (canonical keys).

get_builtin_legend

get_builtin_legend(name: str) -> _LegendPreset

Return a built-in legend preset by name.

Parameters:

Name Type Description Default
name str

A preset name (e.g. "nlcd", "esa_worldcover", "esa"). Matching is case-insensitive and a small set of aliases is accepted.

required

Returns:

Type Description
_LegendPreset

A dict with "title" (str) and "items" (a list of

_LegendPreset

(label, color) pairs).

Raises:

Type Description
ValueError

If no preset matches name.