Interactive interface for browsing global, full-resolution satellite imagery
hydrate and dehydrate bandCombo objects (#4705)
Patrick Moulden2be3cc0c2488
diff --git a/web/js/modules/layers/selectors.js b/web/js/modules/layers/selectors.jsindex d88ce4972..0e9a42bd3 100644--- a/web/js/modules/layers/selectors.js+++ b/web/js/modules/layers/selectors.js@@ -43,13 +43,17 @@ export function addLayer(id, spec = {}, layersParam, layerConfig, overlayLength,def.disabled = spec.disabled || undefined;def.count = spec.count || undefined;- if (spec.bandCombo) {+ if (Array.isArray(spec.bandCombo)) {def.bandCombo = {r: spec.bandCombo[0],g: spec.bandCombo[1],b: spec.bandCombo[2],};- } else if (bandComboParam) {+ } else if (spec.bandCombo) {+ def.bandCombo = spec.bandCombo;+ }++ if (bandComboParam) {def.bandCombo = bandComboParam;}diff --git a/web/js/modules/layers/util.js b/web/js/modules/layers/util.jsindex 81c77ca20..22895a5f4 100644--- a/web/js/modules/layers/util.js+++ b/web/js/modules/layers/util.js@@ -840,7 +840,7 @@ export function serializeLayers(layers, state, groupName) {});}if (def.bandCombo) {- const bandComboString = JSON.stringify(def.bandCombo).replaceAll('(', '<').replaceAll(')', '>');+ const bandComboString = JSON.stringify(def.bandCombo).replaceAll('(', '<').replaceAll(')', '>').replaceAll(',', ';');item.attributes.push({id: 'bandCombo',value: bandComboString,@@ -983,6 +983,11 @@ const getLayerSpec = (attributes) => {bandCombo = values;}+ if (attr.id === 'bandCombo') {+ const formattedString = attr.value.replaceAll(';', ',').replaceAll('<', '(').replaceAll('>', ')');+ bandCombo = JSON.parse(formattedString);+ }+if (attr.id === 'palette') {const values = util.toArray(attr.value.split(';'));custom = values;