Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Add filtering by feature with default style fallback

ZachTRice7778cff93061
diff --git a/config/default/common/config/wv.json/layers/vector/MODIS_Aqua_Thermal_Anomalies_All_v6_NRT.json b/config/default/common/config/wv.json/layers/vector/MODIS_Aqua_Thermal_Anomalies_All_v6_NRT.json
index f972b0bbc..34682fb8c 100644
--- a/config/default/common/config/wv.json/layers/vector/MODIS_Aqua_Thermal_Anomalies_All_v6_NRT.json
+++ b/config/default/common/config/wv.json/layers/vector/MODIS_Aqua_Thermal_Anomalies_All_v6_NRT.json
@@ -13,7 +13,7 @@
],
"inactive": true,
"vectorStyle": {
- "id": "FIRMS_MODIS_Thermal_Anomalies"
+ "id": "MODIS_Aqua_Thermal_Anomalies_All_v6_NRT"
},
"period": "daily"
}
diff --git a/config/default/common/config/wv.json/layers/vector/MODIS_Aqua_Thermal_Anomalies_Day_v6_NRT.json b/config/default/common/config/wv.json/layers/vector/MODIS_Aqua_Thermal_Anomalies_Day_v6_NRT.json
index 89d3cfdf3..b90ff1f69 100644
--- a/config/default/common/config/wv.json/layers/vector/MODIS_Aqua_Thermal_Anomalies_Day_v6_NRT.json
+++ b/config/default/common/config/wv.json/layers/vector/MODIS_Aqua_Thermal_Anomalies_Day_v6_NRT.json
@@ -13,7 +13,7 @@
],
"inactive": true,
"vectorStyle": {
- "id": "FIRMS_MODIS_Thermal_Anomalies"
+ "id": "MODIS_Aqua_Thermal_Anomalies_Day_v6_NRT"
},
"period": "daily"
}
diff --git a/config/default/common/config/wv.json/layers/vector/MODIS_Aqua_Thermal_Anomalies_Night_v6_NRT.json b/config/default/common/config/wv.json/layers/vector/MODIS_Aqua_Thermal_Anomalies_Night_v6_NRT.json
index 4876d92d5..220e227c0 100644
--- a/config/default/common/config/wv.json/layers/vector/MODIS_Aqua_Thermal_Anomalies_Night_v6_NRT.json
+++ b/config/default/common/config/wv.json/layers/vector/MODIS_Aqua_Thermal_Anomalies_Night_v6_NRT.json
@@ -13,7 +13,7 @@
],
"inactive": true,
"vectorStyle": {
- "id": "FIRMS_MODIS_Thermal_Anomalies"
+ "id": "MODIS_Aqua_Thermal_Anomalies_Night_v6_NRT"
},
"period": "daily"
}
diff --git a/config/default/common/config/wv.json/layers/vector/MODIS_Combined_Thermal_Anomalies_All_v6_NRT.json b/config/default/common/config/wv.json/layers/vector/MODIS_Combined_Thermal_Anomalies_All_v6_NRT.json
index e466c934a..285c7adad 100644
--- a/config/default/common/config/wv.json/layers/vector/MODIS_Combined_Thermal_Anomalies_All_v6_NRT.json
+++ b/config/default/common/config/wv.json/layers/vector/MODIS_Combined_Thermal_Anomalies_All_v6_NRT.json
@@ -13,7 +13,7 @@
],
"inactive": true,
"vectorStyle": {
- "id": "FIRMS_MODIS_Thermal_Anomalies"
+ "id": "MODIS_Combined_Thermal_Anomalies_All_v6_NRT"
},
"period": "daily"
}
diff --git a/config/default/common/config/wv.json/layers/vector/MODIS_Combined_Thermal_Anomalies_Day_v6_NRT.json b/config/default/common/config/wv.json/layers/vector/MODIS_Combined_Thermal_Anomalies_Day_v6_NRT.json
index 56ff7907b..768682e1f 100644
--- a/config/default/common/config/wv.json/layers/vector/MODIS_Combined_Thermal_Anomalies_Day_v6_NRT.json
+++ b/config/default/common/config/wv.json/layers/vector/MODIS_Combined_Thermal_Anomalies_Day_v6_NRT.json
@@ -13,7 +13,7 @@
],
"inactive": true,
"vectorStyle": {
- "id": "FIRMS_MODIS_Thermal_Anomalies"
+ "id": "MODIS_Combined_Thermal_Anomalies_Day_v6_NRT"
},
"period": "daily"
}
diff --git a/config/default/common/config/wv.json/layers/vector/MODIS_Combined_Thermal_Anomalies_Night_v6_NRT.json b/config/default/common/config/wv.json/layers/vector/MODIS_Combined_Thermal_Anomalies_Night_v6_NRT.json
index 5cf3579c6..7f04e78d4 100644
--- a/config/default/common/config/wv.json/layers/vector/MODIS_Combined_Thermal_Anomalies_Night_v6_NRT.json
+++ b/config/default/common/config/wv.json/layers/vector/MODIS_Combined_Thermal_Anomalies_Night_v6_NRT.json
@@ -13,7 +13,7 @@
],
"inactive": true,
"vectorStyle": {
- "id": "FIRMS_MODIS_Thermal_Anomalies"
+ "id": "MODIS_Combined_Thermal_Anomalies_Night_v6_NRT"
},
"period": "daily"
}
diff --git a/config/default/common/config/wv.json/layers/vector/MODIS_Terra_Thermal_Anomalies_All_v6_NRT.json b/config/default/common/config/wv.json/layers/vector/MODIS_Terra_Thermal_Anomalies_All_v6_NRT.json
index ec1e2464b..3213c9c0c 100644
--- a/config/default/common/config/wv.json/layers/vector/MODIS_Terra_Thermal_Anomalies_All_v6_NRT.json
+++ b/config/default/common/config/wv.json/layers/vector/MODIS_Terra_Thermal_Anomalies_All_v6_NRT.json
@@ -13,7 +13,7 @@
],
"inactive": true,
"vectorStyle": {
- "id": "FIRMS_MODIS_Thermal_Anomalies"
+ "id": "MODIS_Terra_Thermal_Anomalies_All_v6_NRT"
},
"period": "daily"
}
diff --git a/config/default/common/config/wv.json/layers/vector/MODIS_Terra_Thermal_Anomalies_Day_v6_NRT.json b/config/default/common/config/wv.json/layers/vector/MODIS_Terra_Thermal_Anomalies_Day_v6_NRT.json
index 676e8a5f5..5b19f76e4 100644
--- a/config/default/common/config/wv.json/layers/vector/MODIS_Terra_Thermal_Anomalies_Day_v6_NRT.json
+++ b/config/default/common/config/wv.json/layers/vector/MODIS_Terra_Thermal_Anomalies_Day_v6_NRT.json
@@ -13,7 +13,7 @@
],
"inactive": true,
"vectorStyle": {
- "id": "FIRMS_MODIS_Thermal_Anomalies"
+ "id": "MODIS_Terra_Thermal_Anomalies_Day_v6_NRT"
},
"period": "daily"
}
diff --git a/config/default/common/config/wv.json/layers/vector/MODIS_Terra_Thermal_Anomalies_Night_v6_NRT.json b/config/default/common/config/wv.json/layers/vector/MODIS_Terra_Thermal_Anomalies_Night_v6_NRT.json
index d89b2e83b..66e5044eb 100644
--- a/config/default/common/config/wv.json/layers/vector/MODIS_Terra_Thermal_Anomalies_Night_v6_NRT.json
+++ b/config/default/common/config/wv.json/layers/vector/MODIS_Terra_Thermal_Anomalies_Night_v6_NRT.json
@@ -13,7 +13,7 @@
],
"inactive": true,
"vectorStyle": {
- "id": "FIRMS_MODIS_Thermal_Anomalies"
+ "id": "MODIS_Terra_Thermal_Anomalies_Night_v6_NRT"
},
"period": "daily"
}
diff --git a/config/default/common/config/wv.json/layers/vector/VIIRS_SNPP_Thermal_Anomalies_375m_All_v1_NRT.json b/config/default/common/config/wv.json/layers/vector/VIIRS_SNPP_Thermal_Anomalies_375m_All_v1_NRT.json
index cf5d3e2b9..7da12d5c6 100644
--- a/config/default/common/config/wv.json/layers/vector/VIIRS_SNPP_Thermal_Anomalies_375m_All_v1_NRT.json
+++ b/config/default/common/config/wv.json/layers/vector/VIIRS_SNPP_Thermal_Anomalies_375m_All_v1_NRT.json
@@ -13,7 +13,7 @@
],
"inactive": true,
"vectorStyle": {
- "id": "FIRMS_SNPP_Thermal_Anomalies"
+ "id": "VIIRS_SNPP_Thermal_Anomalies_375m_All_v1_NRT"
},
"period": "daily"
}
diff --git a/config/default/common/config/wv.json/layers/vector/VIIRS_SNPP_Thermal_Anomalies_375m_Day_v1_NRT.json b/config/default/common/config/wv.json/layers/vector/VIIRS_SNPP_Thermal_Anomalies_375m_Day_v1_NRT.json
index 64d529f23..01979ec94 100644
--- a/config/default/common/config/wv.json/layers/vector/VIIRS_SNPP_Thermal_Anomalies_375m_Day_v1_NRT.json
+++ b/config/default/common/config/wv.json/layers/vector/VIIRS_SNPP_Thermal_Anomalies_375m_Day_v1_NRT.json
@@ -13,7 +13,7 @@
],
"inactive": true,
"vectorStyle": {
- "id": "FIRMS_SNPP_Thermal_Anomalies"
+ "id": "VIIRS_SNPP_Thermal_Anomalies_375m_Day_v1_NRT"
},
"period": "daily"
}
diff --git a/config/default/common/config/wv.json/layers/vector/VIIRS_SNPP_Thermal_Anomalies_375m_Night_v1_NRT.json b/config/default/common/config/wv.json/layers/vector/VIIRS_SNPP_Thermal_Anomalies_375m_Night_v1_NRT.json
index ae37d9111..651e74862 100644
--- a/config/default/common/config/wv.json/layers/vector/VIIRS_SNPP_Thermal_Anomalies_375m_Night_v1_NRT.json
+++ b/config/default/common/config/wv.json/layers/vector/VIIRS_SNPP_Thermal_Anomalies_375m_Night_v1_NRT.json
@@ -13,7 +13,7 @@
],
"inactive": true,
"vectorStyle": {
- "id": "FIRMS_SNPP_Thermal_Anomalies"
+ "id": "VIIRS_SNPP_Thermal_Anomalies_375m_Night_v1_NRT"
},
"period": "daily"
}
diff --git a/web/js/map/layerbuilder.js b/web/js/map/layerbuilder.js
index 7066b31d0..2f97ab6a0 100644
--- a/web/js/map/layerbuilder.js
+++ b/web/js/map/layerbuilder.js
@@ -9,7 +9,7 @@ import OlTileGridTileGrid from 'ol/tilegrid/TileGrid';
import MVT from 'ol/format/MVT';
import LayerVectorTile from 'ol/layer/VectorTile';
import SourceVectorTile from 'ol/source/VectorTile';
-import { applyStyle } from 'ol-mapbox-style';
+// import { applyStyle } from 'ol-mapbox-style';
import stylefunction from 'ol-mapbox-style/stylefunction';
import lodashCloneDeep from 'lodash/cloneDeep';
import lodashMerge from 'lodash/merge';
@@ -380,31 +380,31 @@ export function mapLayerBuilder(models, config, cache, mapUi, store) {
// source: sourceOptions
// });
- // var styleCache = {};
-
- // var styles = function(feature) {
- // var style = styleCache['default'];
- // if (!style) {
- // style = new Style({
- // image: new CircleStyle({
- // radius: 5,
- // fill: new Fill({
- // color: '#ff0000'
- // })
- // })
- // });
- // styleCache['default'] = style;
- // }
- // return style;
- // };
+ var styleCache = {};
+
+ var styles = function(feature) {
+ var style = styleCache['default'];
+ if (!style) {
+ style = new Style({
+ image: new CircleStyle({
+ radius: 5,
+ fill: new Fill({
+ color: '#ff0000'
+ })
+ })
+ });
+ styleCache['default'] = style;
+ }
+ return style;
+ };
var layer = new LayerVectorTile({
- renderMode: 'image',
- renderBuffer: '5',
+ renterType: 'image',
+ renderBuffer: 5,
extent: extent,
source: sourceOptions,
- declutter: true
- // style: styles
+ declutter: true,
+ style: styles
});
if (config.vectorStyles && def.vectorStyle.id) {
@@ -412,23 +412,34 @@ export function mapLayerBuilder(models, config, cache, mapUi, store) {
var vectorStyle = def.vectorStyle.id;
var glStyle = vectorStyles[vectorStyle];
- console.log(vectorStyles);
- console.log(vectorStyle);
-
- $(document).ready(function() {
- $(document).on('change', document.getElementById('frpCheckbox'), function(e) {
- if (document.getElementById('frpCheckbox').checked === true) {
- stylefunction(layer, glStyle, 'MODIS_Fire_Points_FRP', matrixSet.resolutions);
- } else if (document.getElementById('confidenceCheckbox').checked === true) {
- stylefunction(layer, glStyle, 'MODIS_Fire_Points_Confidence', matrixSet.resolutions);
- } else {
- stylefunction(layer, glStyle, 'default_style', matrixSet.resolutions);
- }
- });
+ console.log(layer);
+ // const source = layer.getSource();
+ const styleFunction = stylefunction(layer, glStyle, 'default_style');
+ // console.log(styleFunction);
+ layer.setStyle(function(feature, resolution) {
+ if (feature.get('CONFIDENCE') > '95') {
+ // console.log('yes')
+ return styleFunction(feature, resolution);
+ } else {
+ // return styleFunction(feature, resolution);
+ }
});
- stylefunction(layer, glStyle, 'default_style', matrixSet.resolutions);
}
+ // $(document).ready(function() {
+ // $(document).on('change', document.getElementById('confidenceCheckbox'), function(e) {
+ // if (document.getElementById('frpCheckbox').checked === true) {
+ // stylefunction(layer, glStyle, 'MODIS_Fire_Points_FRP');
+ // } else if (document.getElementById('confidenceCheckbox').checked === true) {
+ // stylefunction(layer, glStyle, 'MODIS_Fire_Points_Confidence');
+ // } else {
+ // stylefunction(layer, glStyle, 'default_style');
+ // }
+ // });
+ // });
+ // stylefunction(layer, glStyle, 'default_style');
+ // }
+
return layer;
};
diff --git a/web/js/map/ui.js b/web/js/map/ui.js
index ab300e082..bd2992a76 100644
--- a/web/js/map/ui.js
+++ b/web/js/map/ui.js
@@ -148,12 +148,6 @@ export function mapui(models, config, store, ui) {
models.map.events.on('update-layers', reloadLayers);
ui.events.on('last-action', subscribeToStore);
updateProjection(true);
-
- $(document).ready(function() {
- $(document).on('change', document.getElementById('frpCheckbox'), function(e) {
- reloadLayers();
- });
- });
};
const flyToNewExtent = function(extent, rotation) {
let coordinateX = extent[0] + (extent[2] - extent[0]) / 2;