@honua/sdk-js
    Preparing search index...

    Function mountSource

    • Experimental

      Mount a contract Source onto a caller-owned MapLibre map as a styled, interactive layer set and return a disposable handle that owns everything it created.

      The bridge selects GeoJSON materialization or the dynamic query-tile path from declared capabilities and a result-size heuristic (override with options.strategy), applies geometry-appropriate default styling, and can wire click popups and hover feature-state.

      Type Parameters

      • T = Record<string, unknown>

      Parameters

      Returns Promise<MountedSource<T>>

      import * as maplibregl from "maplibre-gl";
      import { connect } from "@honua/sdk-js";
      import { mountSource } from "@honua/sdk-js/map";

      const connection = await connect({
      endpoint: FEATURE_LAYER_URL,
      protocol: "auto",
      authorizationScopeFingerprint: "public",
      });
      const mounted = await mountSource(map, connection.source(), {
      popup: { factory: () => new maplibregl.Popup() },
      hover: true,
      fitBounds: true,
      });
      console.log(mounted.diagnostics.strategy, mounted.diagnostics.reasons);
      // Later: mounted.dispose(); // or `await using mounted = …`