Skip to content

Commit 4132eab

Browse files
authored
fix: don't set bbox for empty feature collections (#130)
Closes #129
1 parent ea7cf3b commit 4132eab

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/components/map.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ export default function Map() {
119119
updateTriggers: [picked, items],
120120
}),
121121
];
122-
console.log(geojson);
123122

124123
if (stacGeoparquetTable) {
125124
layers.push(
@@ -233,7 +232,10 @@ function useStacValueLayerProperties(
233232
case "FeatureCollection":
234233
return {
235234
geojson: value.features as Feature[],
236-
bbox: turfBbox(value as FeatureCollection),
235+
bbox:
236+
(value.features.length > 0 &&
237+
turfBbox(value as FeatureCollection)) ||
238+
undefined,
237239
filled: true,
238240
};
239241
}

tests/app.spec.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,13 @@ test("loads CSDA Planet", async () => {
4141
.element(app.getByRole("heading", { hasText: "Planet" }))
4242
.toBeVisible();
4343
});
44+
45+
test("loads NAIP stac-geoparquet", async () => {
46+
window.history.pushState(
47+
{},
48+
"",
49+
"?href=https://raw.githubusercontent.com/developmentseed/labs-375-stac-geoparquet-backend/refs/heads/main/data/naip.parquet",
50+
);
51+
const app = await renderApp();
52+
await expect.element(app.getByText(/stac-geoparquet/i)).toBeVisible();
53+
});

0 commit comments

Comments
 (0)