Function pmtilesProtocolModule

  • The first-party PMTiles ProtocolModule (issue #538).

    pmtilesSource() (src/contract/source.ts) builds its Source.protocol("pmtiles") escape hatch through this exact factory instead of constructing HonuaPmtilesArchive directly, and pmtilesProtocolPlugin (@honua/sdk-js/plugin) packages the same factory as a HonuaPluginFactory<"protocol"> for HonuaPluginRegistry. Both callers run the identical construction path, which is what proves the built-in adapter carries no special registry privilege.

    discover() is synchronous: PMTiles opens its reader lazily on the returned handle's own first describe() call, so no I/O happens before a caller actually asks for archive metadata (REQ-003, issue #538).

    Parameters

    Returns ProtocolModule<"pmtiles", HonuaPmtilesArchive>

    const module = pmtilesProtocolModule();
    const handle = module.discover({
    id: "basemap",
    protocol: "pmtiles",
    locator: { url: "https://example.com/basemap.pmtiles" },
    });
    if (!(handle instanceof Promise)) {
    const info = await handle.adapter.describe();
    console.log(info.bounds);
    }