From 59d4bb6c128421ce63a144d15cc2cabff7a70c46 Mon Sep 17 00:00:00 2001 From: Pete Gadomski Date: Fri, 12 Sep 2025 06:47:47 -0600 Subject: [PATCH] fix: don't set bbox for empty feature collections --- src/components/map.tsx | 6 ++++-- tests/app.spec.tsx | 10 ++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/components/map.tsx b/src/components/map.tsx index 3361529..6ab11f3 100644 --- a/src/components/map.tsx +++ b/src/components/map.tsx @@ -119,7 +119,6 @@ export default function Map() { updateTriggers: [picked, items], }), ]; - console.log(geojson); if (stacGeoparquetTable) { layers.push( @@ -233,7 +232,10 @@ function useStacValueLayerProperties( case "FeatureCollection": return { geojson: value.features as Feature[], - bbox: turfBbox(value as FeatureCollection), + bbox: + (value.features.length > 0 && + turfBbox(value as FeatureCollection)) || + undefined, filled: true, }; } diff --git a/tests/app.spec.tsx b/tests/app.spec.tsx index c8ea0a9..6886295 100644 --- a/tests/app.spec.tsx +++ b/tests/app.spec.tsx @@ -41,3 +41,13 @@ test("loads CSDA Planet", async () => { .element(app.getByRole("heading", { hasText: "Planet" })) .toBeVisible(); }); + +test("loads NAIP stac-geoparquet", async () => { + window.history.pushState( + {}, + "", + "?href=https://raw.githubusercontent.com/developmentseed/labs-375-stac-geoparquet-backend/refs/heads/main/data/naip.parquet", + ); + const app = await renderApp(); + await expect.element(app.getByText(/stac-geoparquet/i)).toBeVisible(); +});