Interactive interface for browsing global, full-resolution satellite imagery
Fix running data on wrapped vectors #2511
Benjamin Kingeb9a428f9165
diff --git a/web/js/map/runningdata.js b/web/js/map/runningdata.jsindex 999f5c6cf..312aa5788 100644--- a/web/js/map/runningdata.js+++ b/web/js/map/runningdata.js@@ -41,6 +41,7 @@ export function MapRunningData(models, compareUi, store) {*/self.newPoint = function(pixels, map) {const state = store.getState();+ const proj = state.proj;const activeLayerObj = {};const [lon, lat] = map.getCoordinateFromPixel(pixels);let swipeOffset;@@ -48,33 +49,36 @@ export function MapRunningData(models, compareUi, store) {swipeOffset = Math.floor(compareUi.getOffset());}- if (!(lon < -180 || lon > 180 || lat < -90 || lat > 90)) {- map.forEachFeatureAtPixel(pixels, (feature, layer) => {- const def = lodashGet(layer, 'wv.def');- if (!def || !isFromActiveCompareRegion(map, pixels, layer.wv, state.compare, swipeOffset)) return;- let color;- const identifier = def.palette.styleProperty;- const layerId = def.id;- const paletteLegends = getPalette(layerId, undefined, undefined, state);- const legend = paletteLegends.legend;+ map.forEachFeatureAtPixel(pixels, (feature, layer) => {+ const def = lodashGet(layer, 'wv.def');+ if (!def) return;+ const isWrapped = proj.id === 'geographic' && (def.wrapadjacentdays || def.wrapX);+ console.log(isWrapped);+ const isRenderedFeature = isWrapped ? (lon > -250 || lon < 250 || lat > -90 || lat < 90) : true;+ if (!isRenderedFeature || !isFromActiveCompareRegion(map, pixels, layer.wv, state.compare, swipeOffset)) return;+ let color;+ const identifier = def.palette.styleProperty;+ const layerId = def.id;+ const paletteLegends = getPalette(layerId, undefined, undefined, state);+ const legend = paletteLegends.legend;++ if (!identifier && legend.colors.length > 1) return;+ if (identifier) {+ const properties = feature.getProperties();+ const value = properties[identifier] || def.palette.unclassified;+ if (!value) return;+ const tooltips = legend.tooltips.map(c => c.toLowerCase().replace(/\s/g, ''));+ const colorIndex = tooltips.indexOf(value.toLowerCase().replace(/\s/g, ''));+ color = legend.colors[colorIndex];+ } else if (legend.colors.length === 1) {+ color = legend.colors[0];+ }+ activeLayerObj[layerId] = {+ paletteLegends,+ paletteHex: color+ };+ });- if (!identifier && legend.colors.length > 1) return;- if (identifier) {- const properties = feature.getProperties();- const value = properties[identifier] || def.palette.unclassified;- if (!value) return;- const tooltips = legend.tooltips.map(c => c.toLowerCase().replace(/\s/g, ''));- const colorIndex = tooltips.indexOf(value.toLowerCase().replace(/\s/g, ''));- color = legend.colors[colorIndex];- } else if (legend.colors.length === 1) {- color = legend.colors[0];- }- activeLayerObj[layerId] = {- paletteLegends,- paletteHex: color- };- });- }map.forEachLayerAtPixel(pixels, function(layer, data) {if (!layer.wv) return;const { def } = layer.wv;