From d4d97ad7a9c01f8a87f1e2e2e0cb3a177c933ca8 Mon Sep 17 00:00:00 2001 From: Brandon Liu Date: Thu, 9 Jan 2025 16:10:43 +0800 Subject: [PATCH] maplibre: display error on empty bounds [#508] (#510) * If a MapLibre source has empty bounds, no tiles will be displayed. --- js/src/adapters.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/src/adapters.ts b/js/src/adapters.ts index e38855f..60bc976 100644 --- a/js/src/adapters.ts +++ b/js/src/adapters.ts @@ -221,6 +221,13 @@ export class Protocol { } const h = await instance.getHeader(); + + if (h.minLon >= h.maxLon || h.minLat >= h.maxLat) { + console.error( + `Bounds of PMTiles archive ${h.minLon},${h.minLat},${h.maxLon},${h.maxLat} are not valid.` + ); + } + return { data: { tiles: [`${params.url}/{z}/{x}/{y}`],