Serve the Data Library from any server, and let a server shape it (#1807)

A server can answer the library with createLibraryHandler, a fetch handler, and shape what it offers: hide entries (listed: false) or route browser-direct ones through itself (fetch: proxied). View-bounded entries ask for a grid-snapped box, and GeoParquet is read on the server within it. Applications can pass their own tile and data fetchers (createApplicationTools({library: {fetchTile, fetchData}})), and with library.requireCatalog a catalog that does not answer offers nothing and is asked again later. Tile paths have one spelling: integer z/x/y without leading zeros, within the grid and the entry's zooms. A server's index and partition reads are bounded and counted against its subrequest limit.
This commit is contained in:
Sameh Khamis authored and GitHub committed 2026-11-17 23:34:00 -08:00
1 parent 7b4c84a717
commit 9554d6ea71
15 files changed
+1510 -395

No files matched your search

+9 -2
View File
@@ -410,9 +410,11 @@ export const LIBRARY_AERIAL_Z = 10;
* The globe port imagery spec for a tiles entry.
* @param {object} entry Validated tiles entry.
* @param {string} url Tile URL template.
* @param {import('../render/contract/globe').ImagerySpec['fetchTile']|null} [fetchTile]
* Fetches each tile in place of the renderer (`source.tileFetch`).
* @returns {import('../render/contract/globe').ImagerySpec}
*/
export function libraryImagerySpec(entry, url) {
export function libraryImagerySpec(entry, url, fetchTile = null) {
const bbox = entry.source.bounded ? entry.coverage.bbox : null;
const minZoom = entry.source.minZoom ?? 0;
// A dense entry (`minimumTerrainLevelFor`) is hidden where the view is
@@ -442,6 +444,7 @@ export function libraryImagerySpec(entry, url) {
: {}),
...(entry.display.aerial ? { zOrder: LIBRARY_AERIAL_Z } : {}),
...(tileTransform ? { tileTransform } : {}),
...(fetchTile ? { fetchTile } : {}),
};
}
@@ -563,7 +566,11 @@ export function createLibraryTileLayer(
if (host.kind === 'tileset') markBaseTileset(tileset);
try {
imagery = globe.imagery.add(
libraryImagerySpec(entry, source.tileTemplate(entry)),
libraryImagerySpec(
entry,
source.tileTemplate(entry),
source.tileFetch?.(entry) ?? null,
),
);
} catch (error) {
// A renderer without tile hooks cannot draw relief or clear the