Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

workaround for issue with vectors

Jason Kentde3ad473085e
diff --git a/web/js/modules/map/util.js b/web/js/modules/map/util.js
index 4d085f71d..665c0f052 100644
--- a/web/js/modules/map/util.js
+++ b/web/js/modules/map/util.js
@@ -215,12 +215,13 @@ function promiseTileLayer(layer, extent, map) {
currentZ = tileGrid.getZForResolution(resolution, zDirection);
i = 0;
+ const complete = function () {
+ tileSource.un('tileloadend', onLoad);
+ tileSource.un('tileloaderror', onLoad);
+ resolve();
+ };
+
const onLoad = function onLoad (e) {
- const complete = function () {
- tileSource.un('tileloadend', onLoad);
- tileSource.un('tileloaderror', onLoad);
- resolve();
- };
if (e.type === 'tileloadend') {
i -= 1;
if (i === 0) {
@@ -240,7 +241,9 @@ function promiseTileLayer(layer, extent, map) {
try {
tile.load();
} catch (e) {
+ // eslint-disable-next-line no-console
console.error(`Could not load tile with coords: [${one}, ${two}, ${three}] for extent [${extent}]`);
+ // eslint-disable-next-line no-console
console.error(e);
}
if (tile.state === 2) resolve();
@@ -271,6 +274,8 @@ function promiseLayerGroup(layerGroup, map) {
const viewPortExtent = map.getView().calculateExtent(map.getSize());
const layerPromiseArray = layers.map((layer) => {
+ // TODO figure out why vector layers cause preloadinig issues
+ if (layer.isVector) return Promise.resolve();
const layerExtent = layer.getExtent();
const extent = calculateExtent(layerExtent, viewPortExtent);
return promiseTileLayer(layer, extent, map);