Skip to content

Commit 2aeba33

Browse files
authored
fix: only render BitmapLayer if data are available (#211)
Closes #210 This is kind of a hard one to reproduce on-demand, so you might have to just trust that I saw this get fixed (I think) #frontendproblems Here's the preview link to the href used in the bug report: http://ds-preview-stac-map-211.s3-website-us-west-2.amazonaws.com/?href=https://maxar-opendata.s3.amazonaws.com/events/Cyclone-Senyar-Indonesia-Nov-2025/ard/acquisition_collections/102001011DCD2700_collection.json ## Checklist - [x] Code is formatted (`yarn format`) - [x] Code is linted (`yarn lint`) - [x] Code builds (`yarn build`) - [x] Tests pass (`yarn test`) - [x] Commit messages and/or this PR's title are formatted per [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
1 parent 5c2597a commit 2aeba33

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/layers/map.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,21 @@ export default function Map({
103103
`https://titiler.xyz/cog/tiles/WebMercatorQuad/{z}/{x}/{y}.png?url=${cogTileHref}`,
104104
renderSubLayers: (props) => {
105105
const { boundingBox } = props.tile;
106+
const { data, ...otherProps } = props;
106107

107-
return new BitmapLayer(props, {
108-
data: undefined,
109-
image: props.data,
110-
bounds: [
111-
boundingBox[0][0],
112-
boundingBox[0][1],
113-
boundingBox[1][0],
114-
boundingBox[1][1],
115-
],
116-
});
108+
if (data) {
109+
return new BitmapLayer(otherProps, {
110+
image: data,
111+
bounds: [
112+
boundingBox[0][0],
113+
boundingBox[0][1],
114+
boundingBox[1][0],
115+
boundingBox[1][1],
116+
],
117+
});
118+
} else {
119+
return null;
120+
}
117121
},
118122
})
119123
);

0 commit comments

Comments
 (0)