Create a new tile server with the given layer configuration.
Accepts a single layer or an array of layers. Each layer binds a connector to one or more sources. Sources across layers may use different connectors (e.g. local files + HTTP endpoints).
One or more layer configurations binding connectors to sources. A single TileServerLayer is accepted for convenience.
Optionaloptions: TileOptions & IoOptions & Pick<RequestOptions, "onTile">
Tile-level tiling option defaults applied to all sources
unless overridden by per-source options, plus I/O options (cache,
prefetch, range merging, scan budget) and a default onTile hook.
Release all connector resources and cached state.
Clears the instance's own cache (a caller-supplied cache is left
untouched) and closes every unique connector. After calling close(),
this server instance must not be used again.
Resolves when all connectors have been closed.
Forget what is cached about a file, so the next request re-reads its header and index, e.g. after the file was replaced at the same path. Without a path, every configured source is forgotten.
Files with version tags (ETags, file metadata) are detected as changed automatically; this is for connectors and servers that report none.
Optionalpath: string
Source path, or omitted for all sources.
Resolves when the entries are removed from the cache.
Open every configured source ahead of the first tile request: read headers and the top of each spatial index and, within the OpenOptions.warmIndex budget, all upper index levels.
Opening is otherwise lazy. Call this at start-up (or in the init phase of a serverless function) to move that I/O out of the first requests.
Optionaloptions: OpenOptions
Index warm-up budget.
Resolves when every source is open.
Render a vector tile as a PBF-encoded MVT.
Layers appear in the output in the order defined at construction time. Sources are opened on first use and their headers and index pages cached for subsequent calls.
Tile zoom level.
Tile column.
Tile row.
Optionalrequest: RequestOptions
Optional abort signal and onTile hook (overrides the constructor's).
PBF-encoded Mapbox Vector Tile. Returns an empty tile if no features intersect the requested tile bounds.
If a source cannot be read or a budget is exceeded
(annotated with the source path); I/O failures are a
ConnectorError whose status maps to an HTTP status.
Compute the ETag of a tile without rendering it, e.g. to answer
If-None-Match with 304 Not Modified (or to let a CDN revalidate).
It changes whenever a source file, a setting or the library's tile
encoding changes; sources outside their zoom range are not opened.
Tile zoom level.
Tile column.
Tile row.
Optionalrequest: Pick<RequestOptions, "signal">
Optional abort signal.
A strong, quoted ETag, or null when a source's connector
reports no version tag.
Generate TileJSON 3.0.0 metadata derived from all configured sources.
Returns aggregated bounds, zoom range, and a vector_layers array
listing each source's layer name, field schema, and zoom range.
Sources are opened (headers read) if not already open.
tiles: the URL templates from options (required by the
TileJSON spec; empty when not given).name / description: from options, or, for a single source,
the file's header title (or name) and description.bounds: each file's header envelope or, when that is absent or
invalid, the root of its spatial index, converted to WGS 84. Without
either (an unindexed file without envelope) the world is assumed.minzoom / maxzoom: the lowest minZoom and highest maxZoom
of the sources, as the zoom levels served (integers from 0 to 30).fields: the columns actually written as properties, after the
source's properties selection and without the id column (unless
kept) and binary columns.Optionaloptions: TileJSONOptions
Tile URLs and descriptive metadata.
TileJSON metadata object conforming to the 3.0.0 specification.
Stateful tile server with lazy header caching and multi-connector support.
All connectors and sources are bound at construction. Tile requests take only coordinates. FGB headers and spatial indices are cached per source path on first access, amortizing I/O overhead across the lifetime of the instance.
Use case: long-running tile server process with a fixed set of FGB sources. Maximum throughput -- all per-source overhead is amortized after the first request.
Example: Single connector
Example: Multi-connector (local + remote)