fgb-vt - v1.0.4
    Preparing search index...

    Class TileClient

    Semi-stateful tile client.

    A single Connector is bound at construction; Source descriptors are provided per tile() call. An instance-level tile bounds cache is shared across calls, avoiding redundant tile-to-mercator calculations.

    Use case: application sharing one HTTP connector (with auth headers) but querying different FGB sources depending on request context.

    const client = new TileClient(connector, { tolerance: 2 });

    // Different sources per request
    const buildingsTile = await client.tile(14, 8192, 5461, buildingsSource);
    const roadsTile = await client.tile(14, 8192, 5461, roadsSource);

    // Multi-source layered tile
    const layered = await client.tile(14, 8192, 5461, [buildingsSource, roadsSource]);

    await client.close();
    Index

    Constructors

    Methods

    Constructors

    • Create a new tile client bound to the given connector.

      Parameters

      • connector: Connector

        Byte-range reader for accessing FGB files. Shared across all subsequent tile() calls.

      • Optionaloptions: TileOptions

        Tile-level tiling option defaults applied to every call unless overridden by per-source options.

      Returns TileClient

    Methods

    • Release connector resources (pooled connections, file handles, etc.).

      After calling close(), this client instance must not be used again.

      Returns Promise<void>

      Resolves when the underlying connector has been closed.

    • Generate a vector tile from multiple FlatGeobuf sources.

      Each source produces one MVT layer in the output PBF. Layer ordering matches the order of the sources array.

      Parameters

      • z: number

        Tile zoom level.

      • x: number

        Tile column.

      • y: number

        Tile row.

      • sources: Source[]

        Array of source descriptors; each becomes one MVT layer.

      Returns Promise<Uint8Array<ArrayBufferLike>>

      PBF-encoded Mapbox Vector Tile containing one layer per source.

      const pbf = await client.tile(12, 2048, 1365, [
      { name: 'water', path: '/data/water.fgb' },
      { name: 'roads', path: '/data/roads.fgb' },
      ]);
    • Generate a vector tile from a single FlatGeobuf source.

      Convenience overload that wraps the source in a single-element array and delegates to the multi-source implementation.

      Parameters

      • z: number

        Tile zoom level.

      • x: number

        Tile column.

      • y: number

        Tile row.

      • source: Source

        Single source descriptor; produces one MVT layer.

      Returns Promise<Uint8Array<ArrayBufferLike>>

      PBF-encoded Mapbox Vector Tile containing one layer.

      const pbf = await client.tile(14, 8192, 5461, {
      name: 'buildings',
      path: 'https://cdn.example.com/buildings.fgb',
      });