diff --git a/lib/custom-ui/components/drawer/layers-list/layer-card.js b/lib/custom-ui/components/drawer/layers-list/layer-card.js index 2c92d526f..4848da9e8 100644 --- a/lib/custom-ui/components/drawer/layers-list/layer-card.js +++ b/lib/custom-ui/components/drawer/layers-list/layer-card.js @@ -128,7 +128,10 @@ export const LayerCard = ({ } currentlyActive && setActivatedLayer(false); // Check if this is a hurricane track layer - if (layer.uniqueId.includes("-hurr_composite")) { + if ( + layer.uniqueId.includes("-hurr_composite") || + (layer.infoAsObject.Advisory && layer.infoAsObject.Advisory.length < 4) + ) { setAddHurricaneLayers(false); } viewState.terria.workbench.remove(layer); diff --git a/lib/custom-ui/components/drawer/layers-list/layers-list.js b/lib/custom-ui/components/drawer/layers-list/layers-list.js index d601394d4..47bc3ac19 100644 --- a/lib/custom-ui/components/drawer/layers-list/layers-list.js +++ b/lib/custom-ui/components/drawer/layers-list/layers-list.js @@ -78,13 +78,17 @@ export const LayersList = observer( // ); function addStormLayers(item) { + const hpostfix = "-hurr_composite"; let icon_url = viewState.terria.configParameters.plugins.hurricaneIconsURL; + // check to see if this is a storm track layer + // if so, just return + if (item.uniqueId.includes(hpostfix)) return; - // first see if hurricane layers have already been added for this model run + // next see if hurricane layers have already been added for this model run // TODO: probably need to figure out a better way to do this const item_id = getTruncatedId(item.uniqueId); - let new_id = item_id + "-hurr_composite"; + let new_id = item_id + hpostfix; const layer = viewState.terria.workbench.items.find( (list_item) => list_item.uniqueId === new_id );