Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Fix zoomed no imagery bug (#6881)

christof-wittreichfe62d6f587b5
diff --git a/web/js/components/image-download/image-download-panel.js b/web/js/components/image-download/image-download-panel.js
index bce171f85..29a71f359 100644
--- a/web/js/components/image-download/image-download-panel.js
+++ b/web/js/components/image-download/image-download-panel.js
@@ -76,6 +76,7 @@ function ImageDownloadPanel(props) {
const [isSnapshotInProgress, setIsSnapshotInProgress] = useState(false);
const [snapshotStatus, setSnapshotStatus] = useState('');
const abortControllerRef = useRef(null);
+ const dimensionsRef = useRef(null);
const onCancelSnapshot = () => {
abortControllerRef.current?.abort();
@@ -155,6 +156,7 @@ function ImageDownloadPanel(props) {
const timeout = setTimeout(onCancelSnapshot, 180_000);
try {
+ dimensionsRef.current = getDimensions(map, lonlats, currResolution);
setSnapshotStatus('Creating snapshot...');
const startTime = Date.now();
await snapshot(snapshotOptions);
@@ -192,6 +194,7 @@ function ImageDownloadPanel(props) {
onProgressChange(false);
abortControllerRef.current = null;
changeResolution(currResolution);
+ dimensionsRef.current = null;
}
};
@@ -271,7 +274,7 @@ function ImageDownloadPanel(props) {
};
const { crs } = projection.selected;
- const dimensions = getDimensions(map, lonlats, currResolution);
+ const dimensions = dimensionsRef.current || getDimensions(map, lonlats, currResolution);
const { height } = dimensions;
const { width } = dimensions;
const filetypeSelect = renderFileTypeSelect();
diff --git a/web/js/modules/image-download/util.js b/web/js/modules/image-download/util.js
index dd7c4e897..3c0a9dcde 100644
--- a/web/js/modules/image-download/util.js
+++ b/web/js/modules/image-download/util.js
@@ -737,6 +737,7 @@ function createMapRestore(map, extent, abortSignal, tileMatrixID, onerror) {
const originalStyleHeight = mapElement.style.height;
const restoreLayers = toggleHighResTileGrids(map, abortSignal, tileMatrixID, onerror);
+ restoreLayers();
return () => {
// Restore original map size