Skip to content

formatOfSource

formatOfSource(source): "pmtiles" | "flatgeobuf" | "geoparquet" | "cog" | undefined

Defined in: packages/core/src/formats/detect.ts:149

The cloud-native format a source reads, or undefined for an ordinary source (a TileJSON URL, a GeoJSON file, inline data, a tiles: list).

ParameterType
sourceunknown

"pmtiles" | "flatgeobuf" | "geoparquet" | "cog" | undefined

A valid format: wins (the URL may be extensionless or a redirect); otherwise the URL’s scheme or extension decides. The source type is NOT consulted: a .pmtiles URL on a geojson source is still PMTiles — formatTypeMismatch reports that as the author’s mistake rather than this function hiding it. The one exception is type: grid, which maplibre-yaml reads itself (its encoding: says how): a .tif grid is not a COG, so it never reaches a tile protocol.