GeoLeaf Core API - v3.0.0
    Preparing search index...

    MapLibre GL JS adapter — implements IMapAdapter. One instance per map.

    Implements

    Index

    Constructors

    Methods

    • Subscribes to a map event.

      The handler receives an engine-specific event object (unknown). Adapters normalise geographic coordinates to GeoLeafLatLng within the event object where applicable.

      Parameters

      • event: MapEvent

        Event type token.

      • handler: (e: unknown) => void

        Callback invoked on each occurrence.

      Returns void

    • Unsubscribes a previously registered event handler. Silently does nothing if the handler was not registered.

      Parameters

      • event: MapEvent

        Event type token.

      • handler: (e: unknown) => void

        The exact function reference passed to on().

      Returns void

    • Sets feature-state on a registered source's feature, targeted by its promoted id. Used for reactive paint (POI sync badge, hover/selection halo) without rebuilding the source data. No-op if the source is gone. The source must declare promoteId for a string id to resolve.

      Parameters

      • id: string
      • featureId: string | number
      • state: Record<string, unknown>

      Returns void

    • Applies a filter expression to a registered layer's sub-layers. For cluster groups, filters the unclustered-point layer specifically. Pass null to clear the filter.

      Parameters

      • id: string
      • filter: unknown

      Returns void

    • Sets the zoom range on every sub-layer of a registered layer.

      Iterates getSubLayerIds rather than subLayerTypes: only the former carries the cluster sub-layers (they are registered via customSubLayerIds), and a cluster left out of the range would keep rendering outside it.

      Parameters

      • id: string
      • minZoom: number | null
      • maxZoom: number | null

      Returns void

    • Builds a transformStyle callback that preserves the GeoLeaf-owned sources and layers across a map.setStyle() basemap swap, so they survive natively instead of being torn down and re-injected from JS (the former geoleaf:style:rebuild dance — audit redundancy #1).

      Snapshots ownership from the layer registry (GeoJSON sub-layers + sources), the POI cluster ids, and the sentinel z-anchor. Returns null when nothing is owned yet (e.g. a switch before any data layer exists), letting the caller fall back to a plain setStyle().

      Called by the basemap registry immediately before setStyle().

      Returns StyleTransform | null

    • Re-registers runtime images wiped by map.setStyle(). The transformStyle merge (see buildStyleChangeTransform) preserves sources and layers, but images added via map.addImage() (POI sprite icons) are not part of the style spec and are always cleared. Skipped when no profile sprite is present, so sprite-less profiles pay nothing and log no warning.

      Called by the basemap registry inside the post-swap style.load handler.

      Returns void