removeLegend

fun removeLegend(id: String, force: Boolean = false)

Removes a legend it from the UI if no longer needed.

This function implements a reference-counting mechanism to allow multiple map layers to share the same legend. The legend's visual components are only removed from the containerView when its reference count reaches zero, or if force is set to true.

Parameters

id

The unique identifier of the legend to be removed.

force

If true, immediately removes the legend from the UI and cache, ignoring the current reference count.