diff --git a/app/assets/scripts/components/common/layers/index.js b/app/assets/scripts/components/common/layers/index.js index c0d20c40..58044580 100644 --- a/app/assets/scripts/components/common/layers/index.js +++ b/app/assets/scripts/components/common/layers/index.js @@ -1,4 +1,4 @@ -import get from 'lodash.get'; +import defaultsDeep from 'lodash.defaultsdeep'; import no2 from './layer-no2'; import no2Diff from './layer-no2-diff'; @@ -18,7 +18,7 @@ import waterGlSpm from './layer-wq-gl-spm'; import detectionPlane from './layer-detection-plane'; import agTogo from './layer-togo-ag'; -const layers = [ +const layerOverrides = [ no2, no2Diff, co2, @@ -38,196 +38,30 @@ const layers = [ agTogo ]; -export default layers; - -const layersBySpotlight = { - be: ['no2', 'no2-diff', 'co2', 'co2-diff', 'nightlights-hd', 'nightlights-viirs', 'slowdown', 'recovery', 'detection-plane'], - du: ['no2', 'no2-diff', 'co2', 'co2-diff', 'nightlights-hd', 'nightlights-viirs', 'slowdown', 'recovery'], - gh: ['no2', 'no2-diff', 'co2', 'co2-diff', 'nightlights-hd', 'nightlights-viirs', 'slowdown', 'recovery'], - la: ['no2', 'no2-diff', 'co2', 'co2-diff', 'nightlights-hd', 'nightlights-viirs', 'agriculture', 'slowdown', 'detection-ship', 'detection-plane', 'recovery'], - sf: ['no2', 'no2-diff', 'co2', 'co2-diff', 'nightlights-hd', 'nightlights-viirs', 'agriculture', 'slowdown', 'recovery', 'detection-ship', 'detection-plane', 'water-chlorophyll', 'water-spm'], - tk: ['no2', 'no2-diff', 'co2', 'co2-diff', 'nightlights-hd', 'nightlights-viirs', 'recovery', 'detection-plane'], - ny: ['no2', 'no2-diff', 'co2', 'co2-diff', 'nightlights-hd', 'nightlights-viirs', 'slowdown', 'detection-ship', 'detection-plane', 'water-chlorophyll', 'water-spm', 'recovery'], - togo: ['togo-ag'], - wble: ['water-wq-gl-chl', 'water-wq-gl-spm'] -}; - -const layerOverridesBySpotlight = { - be: { - 'nightlights-viirs': handleNightlightsViirs, - 'detection-plane': (l, spotlightId) => - handleInferenceTimeseries(l, spotlightId, { - domain: ['2020-01-09', '2020-01-12', '2020-01-14', '2020-02-10', '2020-02-18', '2020-03-12', '2020-03-13', '2020-03-19', '2020-04-11', '2020-05-05', '2020-05-14'] - }) - - }, - du: { - 'nightlights-viirs': handleNightlightsViirs - }, - gh: { - 'nightlights-viirs': handleNightlightsViirs - }, - la: { - 'nightlights-viirs': handleNightlightsViirs, - 'detection-multi': (l, spotlightId) => - handleInferenceTimeseries(l, spotlightId, { - domain: ['2020-01-02', '2020-02-13'] - }), - 'detection-ship': (l, spotlightId) => - handleInferenceTimeseries(l, spotlightId, { - domain: ['2020-01-01', '2020-01-06', '2020-01-07', '2020-01-09', '2020-01-10', '2020-01-12', '2020-01-13', '2020-01-14', '2020-01-17', '2020-01-18', '2020-01-19', '2020-01-22', '2020-01-23', '2020-01-24', '2020-01-27', '2020-01-28', '2020-01-29', '2020-01-30', '2020-01-31', '2020-02-02', '2020-02-03', '2020-02-27', '2020-02-29', '2020-03-03', '2020-03-08', '2020-03-15', '2020-03-21', '2020-03-22', '2020-03-27', '2020-04-23', '2020-04-24', '2020-05-01', '2020-05-02', '2020-05-03', '2020-05-04', '2020-05-05', '2020-05-06', '2020-05-07', '2020-05-08', '2020-05-09', '2020-05-11', '2020-05-12', '2020-05-13', '2020-05-14', '2020-05-15', '2020-05-16', '2020-05-17', '2020-05-19', '2020-05-20', '2020-05-21'] - }), - 'detection-plane': (l, spotlightId) => - handleInferenceTimeseries(l, spotlightId, { - domain: ['2020-01-10', '2020-01-14', '2020-02-01', '2020-02-03', '2020-03-22', '2020-04-15', '2020-04-21', '2020-05-04', '2020-05-05'] - }) - }, - sf: { - 'nightlights-viirs': handleNightlightsViirs, - 'detection-ship': (l, spotlightId) => - handleInferenceTimeseries(l, spotlightId, { - domain: ['2020-01-02', '2020-01-03', '2020-01-05', '2020-01-07', '2020-01-10', '2020-01-11', '2020-01-12', '2020-01-13', '2020-01-14', '2020-01-17', '2020-01-18', '2020-01-23', '2020-01-27', '2020-01-30', '2020-01-31', '2020-05-01', '2020-05-03', '2020-05-04', '2020-05-05', '2020-05-06', '2020-05-07', '2020-05-08', '2020-01-02', '2020-01-03', '2020-01-05', '2020-01-07', '2020-01-10', '2020-01-11', '2020-01-12', '2020-01-13', '2020-01-14', '2020-01-17', '2020-01-18', '2020-01-22', '2020-01-23', '2020-01-27', '2020-01-30', '2020-01-31', '2020-02-03', '2020-02-27', '2020-02-29', '2020-03-03', '2020-03-08', '2020-03-10', '2020-03-11', '2020-04-21', '2020-05-01', '2020-05-03', '2020-05-04', '2020-05-05', '2020-05-06', '2020-05-07', '2020-05-08', '2020-05-09', '2020-05-15', '2020-05-16', '2020-05-17', '2020-05-19', '2020-05-20', '2020-05-21'] - }), - 'water-chlorophyll': (l, spotlightId) => { - return { - ...l, - domain: ['2020-03-02', '2020-04-03', '2020-04-19', '2020-05-04', '2020-05-05', '2020-05-19', '2020-05-21', '2020-05-24', '2020-06-01', '2020-06-03', '2020-06-06', '2020-06-13', '2020-06-18', '2020-06-21', '2020-06-22', '2020-06-23', '2020-06-26', '2020-06-28', '2020-07-01', '2020-07-03', '2020-07-06', '2020-07-08', '2020-07-13'] - }; - }, - 'water-spm': (l, spotlightId) => { - return { - ...l, - domain: ['2020-03-02', '2020-04-03', '2020-04-19', '2020-05-04', '2020-05-05', '2020-05-21', '2020-05-24', '2020-05-28', '2020-06-01', '2020-06-03', '2020-06-06', '2020-06-13', '2020-06-21', '2020-06-22', '2020-06-23', '2020-06-25', '2020-06-28', '2020-07-01', '2020-07-03'] - }; - }, - 'detection-plane': (l, spotlightId) => - handleInferenceTimeseries(l, spotlightId, { - domain: ['2020-01-11', '2020-01-12', '2020-01-13', '2020-02-06', '2020-02-07', '2020-02-10', '2020-02-15', '2020-02-18', '2020-02-20', '2020-03-09', '2020-03-10', '2020-03-12', '2020-03-19', '2020-04-02', '2020-04-03', '2020-04-07', '2020-04-15', '2020-04-22', '2020-05-04', '2020-05-05', '2020-05-07', '2020-05-19'] - }) - }, - tk: { - 'nightlights-viirs': handleNightlightsViirs, - 'water-chlorophyll': (l, spotlightId) => { - return { - ...l, - domain: ['2018-01-03', '2018-01-10', '2018-01-17', '2018-01-24', '2018-01-31', '2018-02-14', '2018-02-21', '2018-03-07', '2018-03-14', '2018-03-28', '2018-04-04', '2018-04-11', '2018-04-18', '2018-04-25', '2018-05-02', '2018-05-09', '2018-05-16', '2018-05-30', '2018-06-20', '2018-06-27', '2018-07-04', '2018-07-11', '2018-07-18', '2018-07-25', '2018-08-01', '2018-08-08', '2018-08-22', '2018-09-05', '2018-09-12', '2018-09-19', '2018-09-26', '2018-10-03', '2018-10-17', '2018-10-24', '2018-11-07', '2018-11-14', '2018-11-21', '2018-11-28', '2018-12-12', '2018-12-19', '2018-12-26', '2019-01-02', '2019-01-09', '2019-01-16', '2019-01-23', '2019-01-30', '2019-02-13', '2019-02-27', '2019-03-06', '2019-03-13', '2019-03-20', '2019-03-27', '2019-04-03', '2019-04-10', '2019-05-08', '2019-05-15', '2019-05-22', '2019-05-29', '2019-06-12', '2019-06-19', '2019-07-24', '2019-07-31', '2019-08-07', '2019-08-14', '2019-08-21', '2019-08-28', '2019-09-04', '2019-09-11', '2019-09-25', '2019-10-02', '2019-10-09', '2019-10-23', '2019-10-30', '2019-11-06', '2019-11-13', '2019-11-20', '2019-11-27', '2019-12-11', '2019-12-18', '2019-12-25', '2020-01-01', '2020-01-08', '2020-01-15', '2020-01-29', '2020-02-05', '2020-02-19', '2020-02-26', '2020-03-04', '2020-03-18', '2020-03-25', '2020-04-01', '2020-04-08', '2020-04-15', '2020-04-29', '2020-05-06', '2020-05-13', '2020-05-20', '2020-06-03', '2020-06-10', '2020-06-13', '2020-07-25', '2020-08-01', '2020-08-08', '2020-08-15'], - source: { - ...l.source, - tiles: l.source.tiles.map(t => t.replace('&rescale=-100%2C100', '')) - } - }; - }, - 'detection-plane': (l, spotlightId) => - handleInferenceTimeseries(l, spotlightId, { - domain: ['2020-01-19', '2020-02-01', '2020-02-05', '2020-03-18', '2020-03-19', '2020-04-09', '2020-04-10', '2020-05-02'] - }) - }, - ny: { - 'nightlights-viirs': handleNightlightsViirs, - 'water-chlorophyll': (l, spotlightId) => { - return { - ...l, - domain: ['2020-01-01', '2020-01-08', '2020-01-15', '2020-01-22', '2020-01-29', '2020-02-05', '2020-02-12', '2020-02-19', '2020-02-26', '2020-03-04', '2020-03-11', '2020-03-18', '2020-03-25', '2020-04-01', '2020-04-08', '2020-04-15', '2020-04-22', '2020-04-29', '2020-05-06', '2020-05-13', '2020-05-20', '2020-05-27', '2020-06-03', '2020-06-10', '2020-06-17', '2020-06-24', '2020-07-01', '2020-07-08', '2020-07-15', '2020-07-22', '2020-07-29', '2020-08-05', '2020-08-12', '2020-09-02', '2020-09-09', '2020-09-16', '2020-09-23', '2020-09-30'] - }; - }, - 'detection-ship': (l, spotlightId) => - handleInferenceTimeseries(l, spotlightId, { - domain: ['2020-01-02', '2020-01-09', '2020-01-11', '2020-01-16', '2020-01-17', '2020-01-19', '2020-01-23', '2020-01-24', '2020-01-30', '2020-05-02', '2020-05-05', '2020-01-02', '2020-01-09', '2020-01-11', '2020-01-16', '2020-01-17', '2020-01-19', '2020-01-20', '2020-01-21', '2020-01-22', '2020-01-23', '2020-01-24', '2020-01-30', '2020-02-02', '2020-02-03', '2020-02-29', '2020-03-08', '2020-03-18', '2020-03-22', '2020-03-27', '2020-05-02', '2020-05-05', '2020-05-09', '2020-05-10', '2020-05-13', '2020-05-14', '2020-05-16', '2020-05-19', '2020-05-20', '2020-05-21'] - }), - 'water-spm': (l, spotlightId) => { - return { - ...l, - domain: ['2020-01-01', '2020-01-08', '2020-01-15', '2020-01-22', '2020-01-29', '2020-02-05', '2020-02-12', '2020-02-19', '2020-02-26', '2020-03-04', '2020-03-11', '2020-03-18', '2020-03-25', '2020-04-01', '2020-04-08', '2020-04-15', '2020-04-22', '2020-04-29', '2020-05-06', '2020-05-13', '2020-05-20', '2020-05-27', '2020-06-03', '2020-06-10', '2020-06-17', '2020-06-24', '2020-07-01', '2020-07-08', '2020-07-15', '2020-07-22', '2020-07-29', '2020-08-05', '2020-08-12', '2020-09-02', '2020-09-09', '2020-09-16', '2020-09-23', '2020-09-30'] - }; - }, - 'nightlights-hd': (l, spotlightId) => { - return { - ...l, - // For NY, nightlights goes till June - domain: [l.domain[0], '2020-06-01'] - }; - }, - 'detection-plane': (l, spotlightId) => - handleInferenceTimeseries(l, spotlightId, { - domain: ['2020-01-16', '2020-01-20', '2020-02-17', '2020-02-19', '2020-03-09', '2020-03-15', '2020-04-06', '2020-04-15', '2020-05-05', '2020-05-14'] - }) - } -}; +// Store the layer data. +const layersDataBySpotlight = {}; export function getSpotlightLayers (spotlightId) { - const layersToUse = layersBySpotlight[spotlightId] || []; - - // Filter by the layers to include & - // Replace the {site} property on the layers - return layers - .filter((l) => layersToUse.includes(l.id)) - .map((layer) => { - let l = handleSpotlightId(layer, spotlightId); - - // Apply override function if it exists - const overrideFn = get(layerOverridesBySpotlight, [spotlightId, l.id]); - l = overrideFn ? overrideFn(l, spotlightId) : l; - - return l; - }); + return layersDataBySpotlight[spotlightId]; } export function getGlobalLayers () { - const layersToUse = ['no2', 'no2-diff', 'co2', 'co2-diff', 'gibs-population', 'agriculture']; - return layers.filter((l) => layersToUse.includes(l.id)); + return layersDataBySpotlight.global; } -// // // // // // // // // // // // // // // // // // // // // // // // // // // -// // // // // // // // // // // // // // // // // // // // // // // // // // // -// Layer helper functions below. - -function handleSpotlightId (l, spotlightId) { - // If we're dealing with a layer with a standard source, replace the - // spotlightId in the source tiles. Other layers will be handled by the - // override functions. - const tiles = get(l, 'source.tiles'); - return tiles - ? { - ...l, - source: { - ...l.source, - tiles: tiles.map((t) => t.replace('{spotlightId}', spotlightId)) - } - } - : l; -} +export const storeSpotlightLayers = (spotlightId, layers) => { + if (spotlightId === 'global') { + layersDataBySpotlight[spotlightId] = layers; + return; + } -function handleNightlightsViirs (l, spotlightId) { - const spotlightName = spotlightId === 'du' || spotlightId === 'gh' - ? 'EUPorts' - : spotlightId; + // Overrides to the layer settings. + const spotLayers = layers + .map((layer) => { + const overrides = layerOverrides.find(l => l.id === layer.id) || {}; - return { - ...l, - source: { - ...l.source, - tiles: l.source.tiles.map((t) => - t.replace('{spotlightName}', spotlightName) - ) - } - }; -} + return defaultsDeep(layer, overrides); + }); -function handleInferenceTimeseries (l, spotlightId, options) { - return { - ...l, - domain: options.domain, - source: { - ...l.source, - vector: { - ...l.source.vector, - data: l.source.vector.data.replace('{spotlightId}', spotlightId) - }, - raster: { - ...l.source.raster, - tiles: l.source.raster.tiles - .map(t => t.replace('{spotlightId}', spotlightId)) - } - } - }; -} + layersDataBySpotlight[spotlightId] = spotLayers; +}; diff --git a/app/assets/scripts/components/common/layers/layer-agriculture.js b/app/assets/scripts/components/common/layers/layer-agriculture.js index 1bd039c4..3712a0cc 100644 --- a/app/assets/scripts/components/common/layers/layer-agriculture.js +++ b/app/assets/scripts/components/common/layers/layer-agriculture.js @@ -1,35 +1,6 @@ -import config from '../../../config'; - -import { indicatorGroupColors } from '../../../styles/theme/theme.js'; - export default { id: 'agriculture', - name: 'Agriculture', - type: 'raster-timeseries', - timeUnit: 'day', - domain: [ - '2020-01-28', '2020-02-28', '2020-03-28', '2020-04-28', '2020-05-28', '2020-06-28', '2020-07-28', '2020-08-28', '2020-09-28' - ], - source: { - type: 'raster', - tiles: [ - `${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/agriculture/CropMonitor_{date}.tif&resampling_method=nearest&bidx=1&color_map=custom_cropmonitor` - ] - }, exclusiveWith: ['no2', 'co2', 'co2-diff', 'gibs-population', 'car-count', 'nightlights-viirs', 'nightlights-hd', 'detection-ship', 'detection-multi', 'water-chlorophyll', 'water-spm'], enabled: false, - swatch: indicatorGroupColors.economic, - legend: { - type: 'categorical', - stops: [ - { color: '#3C8EC4', label: 'Exceptional' }, - { color: '#6ECC51', label: 'Favourable' }, - { color: '#F3EF4F', label: 'Watch' }, - { color: '#DF6335', label: 'Poor' }, - { color: '#7E170E', label: 'Failure' }, - { color: '#777879', label: 'Out of season' }, - { color: '#794416', label: 'No data' } - ] - }, info: null }; diff --git a/app/assets/scripts/components/common/layers/layer-co2-diff.js b/app/assets/scripts/components/common/layers/layer-co2-diff.js index 12af9275..ea13cf31 100644 --- a/app/assets/scripts/components/common/layers/layer-co2-diff.js +++ b/app/assets/scripts/components/common/layers/layer-co2-diff.js @@ -1,36 +1,6 @@ -import config from '../../../config'; - -import { indicatorGroupColors } from '../../../styles/theme/theme.js'; - export default { id: 'co2-diff', - name: 'CO\u2082 (Diff)', - type: 'raster-timeseries', - timeUnit: 'day', - domain: [ - '2020-01-01', - '2020-07-16' - ], - source: { - type: 'raster', - tiles: [ - `${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/xco2-diff/xco2_16day_diff.{date}.tif&resampling_method=bilinear&bidx=1&rescale=-0.000001%2C0.000001&color_map=rdbu_r` - ] - }, exclusiveWith: ['agriculture', 'no2', 'no2-diff', 'co2', 'gibs-population', 'car-count', 'nightlights-viirs', 'nightlights-hd', 'detection-ship', 'detection-multi', 'water-chlorophyll', 'water-spm'], enabled: false, - swatch: indicatorGroupColors['greenhouse-gas'], - legend: { - type: 'gradient', - min: '< -1 ppm', - max: '> 1 ppm', - stops: [ - '#3A88BD', - '#C9E0ED', - '#E4EEF3', - '#FDDCC9', - '#DD7059' - ] - }, info: 'This layer shows changes in carbon dioxide (CO₂) levels during coronavirus lockdowns versus previous years. Redder colors indicate increases in CO₂. Bluer colors indicate lower levels of CO₂.' }; diff --git a/app/assets/scripts/components/common/layers/layer-co2.js b/app/assets/scripts/components/common/layers/layer-co2.js index 88894101..26d46fd8 100644 --- a/app/assets/scripts/components/common/layers/layer-co2.js +++ b/app/assets/scripts/components/common/layers/layer-co2.js @@ -2,24 +2,8 @@ import { format } from 'date-fns'; import config from '../../../config'; -import { indicatorGroupColors } from '../../../styles/theme/theme.js'; - export default { id: 'co2', - name: 'CO\u2082 (Avg)', - type: 'raster-timeseries', - timeUnit: 'day', - domain: [ - '2020-01-01', - '2020-07-16' - ], - source: { - type: 'raster', - tiles: [ - `${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/xco2-mean/xco2_16day_mean.{date}.tif&resampling_method=bilinear&bidx=1&rescale=0.000408%2C0.000419&color_map=rdylbu_r&color_formula=gamma r {gamma}` - - ] - }, exclusiveWith: ['agriculture', 'no2', 'co2-diff', 'gibs-population', 'car-count', 'nightlights-viirs', 'nightlights-hd', 'detection-ship', 'detection-multi', 'water-chlorophyll', 'water-spm'], enabled: false, compare: { @@ -34,21 +18,5 @@ export default { ] } }, - - swatch: indicatorGroupColors['greenhouse-gas'], - legend: { - type: 'gradient-adjustable', - min: '< 408 ppm', - max: '> 419 ppm', - stops: [ - '#313695', - '#588cbf', - '#a3d2e5', - '#e8f6e8', - '#fee89c', - '#fba55c', - '#e24932' - ] - }, info: 'This layer shows the average background concentration of carbon dioxide (CO₂) in our atmosphere for 2020. Redder colors indicate more CO₂. Whiter colors indicate less CO₂.' }; diff --git a/app/assets/scripts/components/common/layers/layer-detection-plane.js b/app/assets/scripts/components/common/layers/layer-detection-plane.js index 72c04e85..0ae43077 100644 --- a/app/assets/scripts/components/common/layers/layer-detection-plane.js +++ b/app/assets/scripts/components/common/layers/layer-detection-plane.js @@ -1,29 +1,6 @@ -import config from '../../../config'; -import { indicatorGroupColors } from '../../../styles/theme/theme'; - export default { id: 'detection-plane', - name: 'Planes', - type: 'inference-timeseries', - domain: [ - '2020-01-01', - '2020-04-30' - ], - source: { - vector: { - type: 'geojson', - data: `${config.api}/detections/plane/{spotlightId}/{date}.geojson` - }, - raster: { - type: 'raster', - tiles: [ - `${config.api}/planet/{z}/{x}/{y}?date={date}&site={spotlightId}` - ] - } - }, exclusiveWith: ['agriculture', 'no2', 'no2-diff', 'co2-diff', 'co2', 'gibs-population', 'car-count', 'nightlights-viirs', 'nightlights-hd', 'detection-multi', 'water-chlorophyll', 'water-spm'], enabled: false, - swatch: indicatorGroupColors.economic, - timeUnit: 'day', info: 'Planes detected each day in PlanetScope imagery are shown in red.' }; diff --git a/app/assets/scripts/components/common/layers/layer-detection-ship.js b/app/assets/scripts/components/common/layers/layer-detection-ship.js index 3396176f..bdfde62c 100644 --- a/app/assets/scripts/components/common/layers/layer-detection-ship.js +++ b/app/assets/scripts/components/common/layers/layer-detection-ship.js @@ -1,28 +1,6 @@ -import config from '../../../config'; -import { indicatorGroupColors } from '../../../styles/theme/theme'; - export default { id: 'detection-ship', - name: 'Shipping', - type: 'inference-timeseries', - domain: [ - '2020-03-11' - ], - source: { - vector: { - type: 'geojson', - data: `${config.api}/detections/ship/{spotlightId}/{date}.geojson` - }, - raster: { - type: 'raster', - tiles: [ - `${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/planet/{spotlightId}-{date}.tif&resampling_method=nearest&bidx=1,2,3` - ] - } - }, exclusiveWith: ['agriculture', 'no2', 'no2-diff', 'co2-diff', 'co2', 'gibs-population', 'car-count', 'nightlights-viirs', 'nightlights-hd', 'detection-multi', 'water-chlorophyll', 'water-spm'], enabled: false, - swatch: indicatorGroupColors.economic, - timeUnit: 'day', info: 'Ships detected each day in PlanetScope imagery are shown in red.' }; diff --git a/app/assets/scripts/components/common/layers/layer-nightlights-hd.js b/app/assets/scripts/components/common/layers/layer-nightlights-hd.js index da5af816..e442d426 100644 --- a/app/assets/scripts/components/common/layers/layer-nightlights-hd.js +++ b/app/assets/scripts/components/common/layers/layer-nightlights-hd.js @@ -1,34 +1,5 @@ -import config from '../../../config'; -import { indicatorGroupColors } from '../../../styles/theme/theme'; - export default { id: 'nightlights-hd', - name: 'Nightlights HD', - type: 'raster-timeseries', - timeUnit: 'month', - domain: [ - '2020-01-01', - '2020-09-01' - ], - source: { - type: 'raster', - tiles: [ - `${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/bmhd_30m_monthly/BMHD_VNP46A2_{spotlightId}_{date}_cog.tif&resampling_method=bilinear&bidx=1%2C2%2C3` - ] - }, exclusiveWith: ['agriculture', 'no2', 'no2-diff', 'co2-diff', 'co2', 'gibs-population', 'car-count', 'nightlights-viirs', 'detection-ship', 'detection-multi', 'water-chlorophyll', 'water-spm'], - swatch: indicatorGroupColors.economic, - legend: { - type: 'gradient', - min: 'less', - max: 'more', - stops: [ - '#08041d', - '#1f0a46', - '#52076c', - '#f57c16', - '#f7cf39' - ] - }, info: 'The High Definition Nightlights dataset is processed to eliminate light sources, including moonlight reflectance and other interferences. Darker colors indicate fewer night lights and less activity. Lighter colors indicate more night lights and more activity.' }; diff --git a/app/assets/scripts/components/common/layers/layer-nightlights-viirs.js b/app/assets/scripts/components/common/layers/layer-nightlights-viirs.js index 8f682127..3c812290 100644 --- a/app/assets/scripts/components/common/layers/layer-nightlights-viirs.js +++ b/app/assets/scripts/components/common/layers/layer-nightlights-viirs.js @@ -1,27 +1,5 @@ -import config from '../../../config'; -import { indicatorGroupColors } from '../../../styles/theme/theme'; - export default { id: 'nightlights-viirs', - name: 'Nightlights VIIRS', - type: 'raster-timeseries', - timeUnit: 'day', - domain: [ - '2020-01-01', '2020-01-02', '2020-01-03', '2020-01-04', '2020-01-05', '2020-01-06', '2020-01-07', '2020-01-08', '2020-01-09', '2020-01-10', '2020-01-11', '2020-01-12', '2020-01-13', '2020-01-14', '2020-01-15', '2020-01-16', '2020-01-17', '2020-01-18', '2020-01-19', '2020-01-20', '2020-01-21', '2020-01-22', '2020-01-23', '2020-01-24', '2020-01-25', '2020-01-26', '2020-01-27', '2020-01-28', '2020-01-29', '2020-01-30', '2020-01-31', '2020-02-01', '2020-02-02', '2020-02-03', '2020-02-04', '2020-02-05', '2020-02-06', '2020-02-07', '2020-02-08', '2020-02-09', '2020-02-10', '2020-02-11', '2020-02-12', '2020-02-13', '2020-02-14', '2020-02-15', '2020-02-16', '2020-02-17', '2020-02-18', '2020-02-19', '2020-02-20', '2020-02-21', '2020-02-22', '2020-02-23', '2020-02-24', '2020-02-25', '2020-02-26', '2020-02-27', '2020-02-28', '2020-02-29', '2020-03-01', '2020-03-02', '2020-03-03', '2020-03-04', '2020-03-05', '2020-03-06', '2020-03-07', '2020-03-08', '2020-03-09', '2020-03-10', '2020-03-11', '2020-03-12', '2020-03-13', '2020-03-14', '2020-03-15', '2020-03-16', '2020-03-17', '2020-03-18', '2020-03-19', '2020-03-20', '2020-03-21', '2020-03-22', '2020-03-23', '2020-03-24', '2020-03-25', '2020-03-26', '2020-03-27', '2020-03-28', '2020-03-29', '2020-03-30', '2020-03-31', '2020-04-01', '2020-04-02', '2020-04-03', '2020-04-04', '2020-04-05', '2020-04-06', '2020-04-07', '2020-04-08', '2020-04-09', '2020-04-10', '2020-04-11', '2020-04-12', '2020-04-13', '2020-04-14', '2020-04-15', '2020-04-16', '2020-04-17', '2020-04-18', '2020-04-19', '2020-04-20', '2020-04-21', '2020-04-22', '2020-04-23', '2020-04-24', '2020-04-25', '2020-04-26', '2020-04-27', '2020-04-28', '2020-04-29', '2020-04-30', '2020-05-01', '2020-05-02', '2020-05-03', '2020-05-04', '2020-05-05', '2020-05-06', '2020-05-07', '2020-05-08', '2020-05-09', '2020-05-10', '2020-05-11', '2020-05-12', '2020-05-13', '2020-05-14', '2020-05-15', '2020-05-16', '2020-05-17', '2020-05-18', '2020-05-19', '2020-05-20', '2020-05-21', '2020-05-22', '2020-05-23', '2020-05-24', '2020-05-25', '2020-05-26', '2020-05-27', '2020-05-28', '2020-05-29', '2020-05-30', '2020-05-31', '2020-06-01', '2020-06-02', '2020-06-03', '2020-06-04', '2020-06-05', '2020-06-06', '2020-06-07', '2020-06-08', '2020-06-09', '2020-06-10', '2020-06-11', '2020-06-12', '2020-06-13', '2020-06-14', '2020-06-15', '2020-06-16', '2020-06-17', '2020-06-18', '2020-06-19', '2020-06-20', '2020-06-21', '2020-06-22', '2020-06-23', '2020-06-24', '2020-06-25', '2020-06-26', '2020-06-27', '2020-06-28', '2020-06-29', '2020-06-30', '2020-07-01', '2020-07-02', '2020-07-03', '2020-07-04', '2020-07-05', '2020-07-06', '2020-07-07', '2020-07-08', '2020-07-09', '2020-07-10', '2020-07-11', '2020-07-12', '2020-07-13', '2020-07-14', '2020-07-15', '2020-07-16', '2020-07-17', '2020-07-18', '2020-07-19', '2020-07-20', '2020-07-21', '2020-07-22', '2020-07-23', '2020-07-24', '2020-07-25', '2020-07-26', '2020-07-27', '2020-07-28', '2020-07-29', '2020-07-30', '2020-07-31', '2020-08-01', '2020-08-02', '2020-08-03', '2020-08-04', '2020-08-05', '2020-08-06', '2020-08-07', '2020-08-08', '2020-08-09', '2020-08-10', '2020-08-11', '2020-08-12', '2020-08-13', '2020-08-14', '2020-08-15', '2020-08-16', '2020-08-17', '2020-08-18', '2020-08-19', '2020-08-20', '2020-08-21', '2020-08-22', '2020-08-23', '2020-08-24', '2020-08-25', '2020-08-26', '2020-08-27', '2020-08-28', '2020-08-29', '2020-08-30', '2020-08-31', '2020-09-01', '2020-09-02', '2020-09-03', '2020-09-04', '2020-09-05', '2020-09-06', '2020-09-07', '2020-09-08', '2020-09-09', '2020-09-10', '2020-09-11', '2020-09-12', '2020-09-13', '2020-09-14', '2020-09-15', '2020-09-16', '2020-09-17', '2020-09-18', '2020-09-19', '2020-09-20', '2020-09-21', '2020-09-22', '2020-09-23', '2020-09-24', '2020-09-25', '2020-09-26', '2020-09-27', '2020-09-28', '2020-09-29', '2020-09-30', '2020-10-01', '2020-10-02' - ], - source: { - type: 'raster', - tiles: [ - `${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/bm_500m_daily/VNP46A2_V011_{spotlightName}_{date}_cog.tif&resampling_method=nearest&bidx=1&rescale=0%2C100&color_map=viridis` - ] - }, exclusiveWith: ['agriculture', 'no2', 'no2-diff', 'co2-diff', 'co2', 'gibs-population', 'car-count', 'nightlights-hd', 'detection-ship', 'detection-multi', 'water-chlorophyll', 'water-spm'], - swatch: indicatorGroupColors.economic, - legend: { - type: 'gradient', - min: 'less', - max: 'more', - stops: ['#08041d', '#1f0a46', '#52076c', '#f57c16', '#f7cf39'] - }, info: 'Darker colors indicate fewer night lights and less activity. Lighter colors indicate more night lights and more activity. Check out the HD dataset below to see a light-corrected version of this dataset.' }; diff --git a/app/assets/scripts/components/common/layers/layer-no2-diff.js b/app/assets/scripts/components/common/layers/layer-no2-diff.js index d7ea8ba3..d8119f5b 100644 --- a/app/assets/scripts/components/common/layers/layer-no2-diff.js +++ b/app/assets/scripts/components/common/layers/layer-no2-diff.js @@ -1,36 +1,6 @@ -import config from '../../../config'; - -import { indicatorGroupColors } from '../../../styles/theme/theme.js'; - export default { id: 'no2-diff', - name: 'NO\u2082 (Diff)', - type: 'raster-timeseries', - domain: [ - '2018-03-01', - '2020-09-01' - ], - source: { - type: 'raster', - tiles: [ - `${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/OMNO2d_HRMDifference/OMI_trno2_0.10x0.10_{date}_Col3_V4.nc.tif&resampling_method=bilinear&bidx=1&rescale=-3e15%2C3e15&color_map=rdbu_r` - ] - }, exclusiveWith: ['co2', 'co2-diff', 'gibs-population', 'car-count', 'nightlights-viirs', 'nightlights-hd', 'detection-ship', 'detection-multi', 'water-chlorophyll', 'water-spm', 'no2'], enabled: false, - swatch: indicatorGroupColors['air-quality'], - legend: { - type: 'gradient', - min: '< -3', - max: '> 3', - stops: [ - '#3A88BD', - '#C9E0ED', - '#E4EEF3', - '#FDDCC9', - '#DD7059' - - ] - }, info: 'This layer shows changes in nitrogen dioxide (NO₂) levels in µmol/m₂. Redder colors indicate increases in NO₂. Bluer colors indicate lower levels of NO₂.' }; diff --git a/app/assets/scripts/components/common/layers/layer-no2.js b/app/assets/scripts/components/common/layers/layer-no2.js index 51c9a0a6..09a7b294 100644 --- a/app/assets/scripts/components/common/layers/layer-no2.js +++ b/app/assets/scripts/components/common/layers/layer-no2.js @@ -2,22 +2,8 @@ import { format } from 'date-fns'; import config from '../../../config'; -import { indicatorGroupColors } from '../../../styles/theme/theme.js'; - export default { id: 'no2', - name: 'NO\u2082', - type: 'raster-timeseries', - domain: [ - '2018-03-01', - '2020-09-01' - ], - source: { - type: 'raster', - tiles: [ - `${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/OMNO2d_HRM/OMI_trno2_0.10x0.10_{date}_Col3_V4.nc.tif&resampling_method=bilinear&bidx=1&rescale=0%2C1.5e16&color_map=custom_no2&color_formula=gamma r {gamma}` - ] - }, exclusiveWith: ['agriculture', 'no2-diff', 'co2', 'co2-diff', 'gibs-population', 'car-count', 'nightlights-viirs', 'nightlights-hd', 'detection-ship', 'detection-multi', 'water-chlorophyll', 'water-spm'], enabled: true, compare: { @@ -33,19 +19,5 @@ export default { ] } }, - swatch: indicatorGroupColors['air-quality'], - legend: { - type: 'gradient-adjustable', - min: 'less', - max: 'more', - stops: [ - '#99c5e0', - '#f9eaa9', - '#f7765d', - '#c13b72', - '#461070', - '#050308' - ] - }, info: 'Darker colors indicate higher nitrogen dioxide (NO₂) levels associated and more activity. Lighter colors indicate lower levels of NO₂ and less activity.' }; diff --git a/app/assets/scripts/components/common/layers/layer-population.js b/app/assets/scripts/components/common/layers/layer-population.js index b984e53e..0bf8aeef 100644 --- a/app/assets/scripts/components/common/layers/layer-population.js +++ b/app/assets/scripts/components/common/layers/layer-population.js @@ -1,29 +1,5 @@ - -import { indicatorGroupColors } from '../../../styles/theme/theme.js'; - export default { id: 'gibs-population', - name: 'Population', - type: 'raster', - source: { - type: 'raster', - tiles: [ - 'https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/GPW_Population_Density_2020/default/2020-05-14T00:00:00Z/GoogleMapsCompatible_Level7/{z}/{y}/{x}.png' - ] - }, exclusiveWith: ['agriculture', 'no2', 'no2-diff', 'co2-diff', 'co2', 'car-count', 'nightlights-viirs', 'nightlights-hd', 'detection-ship', 'detection-multi', 'water-chlorophyll', 'water-spm'], - swatch: indicatorGroupColors.economic, - legend: { - type: 'gradient', - min: 'less', - max: 'more', - stops: [ - '#FFEFCB', - '#FBA54A', - '#FB9F46', - '#F35228', - '#BD0026' - ] - }, info: null }; diff --git a/app/assets/scripts/components/common/layers/layer-recovery.js b/app/assets/scripts/components/common/layers/layer-recovery.js index bb223e86..b60bb052 100644 --- a/app/assets/scripts/components/common/layers/layer-recovery.js +++ b/app/assets/scripts/components/common/layers/layer-recovery.js @@ -1,22 +1,6 @@ -import config from '../../../config'; - -import { indicatorGroupColors } from '../../../styles/theme/theme.js'; - export default { id: 'recovery', - name: 'Recovery Proxy Map', - type: 'raster', - source: { - type: 'raster', - tiles: [ - `${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/rpm/rpm-{spotlightId}.cog.tif&resampling_method=bilinear&bidx=1%2C2%2C3%24` - ] - }, - paint: { - 'raster-opacity': 0.9 - }, exclusiveWith: ['agriculture', 'co2', 'co2-diff', 'gibs-population', 'car-count', 'nightlights-viirs', 'nightlights-hd', 'detection-ship', 'detection-multi', 'water-chlorophyll', 'water-spm'], enabled: true, - swatch: indicatorGroupColors.economic, info: 'Recovery Proxy Maps show areas with the greatest increase in car activity shaded in orange. Darker orange indicates areas of greater change.' }; diff --git a/app/assets/scripts/components/common/layers/layer-slowdown.js b/app/assets/scripts/components/common/layers/layer-slowdown.js index 573d3b0f..01739b52 100644 --- a/app/assets/scripts/components/common/layers/layer-slowdown.js +++ b/app/assets/scripts/components/common/layers/layer-slowdown.js @@ -1,22 +1,9 @@ -import config from '../../../config'; - -import { indicatorGroupColors } from '../../../styles/theme/theme.js'; - export default { id: 'slowdown', - name: 'Slowdown Proxy Maps', - type: 'raster', - source: { - type: 'raster', - tiles: [ - `${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/slowdown_proxy_map/{spotlightId}.tif&resampling_method=bilinear&bidx=1%2C2%2C3%24` - ] - }, paint: { 'raster-opacity': 0.9 }, exclusiveWith: ['agriculture', 'co2', 'co2-diff', 'gibs-population', 'car-count', 'nightlights-viirs', 'nightlights-hd', 'detection-ship', 'detection-multi', 'water-chlorophyll', 'water-spm'], enabled: true, - swatch: indicatorGroupColors.economic, info: 'Slowdown Proxy Maps show areas with the greatest reduction in car activity shaded in blue. Darker blues indicate areas of greater change.' }; diff --git a/app/assets/scripts/components/common/layers/layer-togo-ag.js b/app/assets/scripts/components/common/layers/layer-togo-ag.js index efc943dc..7585025f 100644 --- a/app/assets/scripts/components/common/layers/layer-togo-ag.js +++ b/app/assets/scripts/components/common/layers/layer-togo-ag.js @@ -1,37 +1,6 @@ - -import config from '../../../config'; - -import { indicatorGroupColors } from '../../../styles/theme/theme.js'; - export default { id: 'togo-ag', - name: 'Agriculture', - type: 'raster', - source: { - type: 'raster', - tiles: [ - `${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/Togo/togo_cropland_v7-1_cog_v2.tif&resampling_method=bilinear&bidx=1&rescale=0%2C1&color_map=inferno` - ] - }, enabled: true, exclusiveWith: [], - swatch: indicatorGroupColors.agriculture, - legend: { - type: 'gradient', - min: 'low', - max: 'high', - stops: [ - '#000000', - '#1a0b40', - '#4b0c6b', - '#791c6d', - '#a42c60', - '#cf4446', - '#ed6825', - '#fb9b06', - '#f6d13c', - '#fbfda2' - ] - }, info: 'Dark purple colors indicate lower probability of cropland while lighter yellow colors indicate higher probability of cropland within each pixel.' }; diff --git a/app/assets/scripts/components/common/layers/layer-water-chlorophyll.js b/app/assets/scripts/components/common/layers/layer-water-chlorophyll.js index f70678d5..fa64c1f1 100644 --- a/app/assets/scripts/components/common/layers/layer-water-chlorophyll.js +++ b/app/assets/scripts/components/common/layers/layer-water-chlorophyll.js @@ -1,33 +1,5 @@ -import config from '../../../config'; - -import { indicatorGroupColors } from '../../../styles/theme/theme.js'; - export default { id: 'water-chlorophyll', - name: 'Chlorophyll', - type: 'raster-timeseries', - domain: [/* spotlight dependent */], - timeUnit: 'day', - source: { - type: 'raster', - tiles: [ - `${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/oc3_chla_anomaly/anomaly-chl-{spotlightId}-{date}.tif&resampling_method=bilinear&bidx=1&rescale=-100%2C100&color_map=rdbu_r` - ] - }, exclusiveWith: ['agriculture', 'no2', 'co2-diff', 'co2', 'gibs-population', 'car-count', 'nightlights-viirs', 'nightlights-hd', 'detection-ship', 'detection-multi', 'water-spm'], - swatch: indicatorGroupColors['water-quality'], - legend: { - type: 'gradient', - min: 'less', - max: 'more', - stops: [ - '#3A88BD', - '#C9E0ED', - '#E4EEF3', - '#FDDCC9', - '#DE725B', - '#67001F' - ] - }, info: 'Chlorophyll is an indicator of algae growth. Redder colors indicate increases in chlorophyll-a and worse water quality. Bluer colors indicate decreases in chlorophyll-a and improved water quality. White areas indicate no change.' }; diff --git a/app/assets/scripts/components/common/layers/layer-water-spm.js b/app/assets/scripts/components/common/layers/layer-water-spm.js index 4d84dc52..10a17691 100644 --- a/app/assets/scripts/components/common/layers/layer-water-spm.js +++ b/app/assets/scripts/components/common/layers/layer-water-spm.js @@ -1,33 +1,5 @@ -import config from '../../../config'; - -import { indicatorGroupColors } from '../../../styles/theme/theme.js'; - export default { id: 'water-spm', - name: 'Turbidity', - type: 'raster-timeseries', - domain: [/* spotlight dependent */], - timeUnit: 'day', - source: { - type: 'raster', - tiles: [ - `${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/spm_anomaly/anomaly-spm-{spotlightId}-{date}.tif&resampling_method=bilinear&bidx=1&rescale=-100%2C100&color_map=rdbu_r` - ] - }, exclusiveWith: ['agriculture', 'no2', 'no2-diff', 'co2-diff', 'co2', 'gibs-population', 'car-count', 'nightlights-viirs', 'nightlights-hd', 'detection-ship', 'detection-multi', 'water-chlorophyll'], - swatch: indicatorGroupColors['water-quality'], - legend: { - type: 'gradient', - min: 'less', - max: 'more', - stops: [ - '#3A88BD', - '#C9E0ED', - '#E4EEF3', - '#FDDCC9', - '#DE725B', - '#67001F' - ] - }, info: 'Turbidity refers to the amount of sediment or particles suspended in water. Darker colors indicate more sediment and murkier water. Lighter colors indicate less sediment and clearer water.' }; diff --git a/app/assets/scripts/components/common/layers/layer-wq-gl-chl.js b/app/assets/scripts/components/common/layers/layer-wq-gl-chl.js index 1f98c162..ee55011d 100644 --- a/app/assets/scripts/components/common/layers/layer-wq-gl-chl.js +++ b/app/assets/scripts/components/common/layers/layer-wq-gl-chl.js @@ -1,33 +1,6 @@ -import config from '../../../config'; - -import { indicatorGroupColors } from '../../../styles/theme/theme.js'; - export default { id: 'water-wq-gl-chl', - name: 'Chlorophyll', - type: 'raster-timeseries', - domain: ['2020-01-01', '2020-01-08', '2020-01-15', '2020-01-22', '2020-01-29', '2020-02-05', '2020-02-12', '2020-02-19', '2020-02-26', '2020-03-04', '2020-03-11', '2020-03-18', '2020-03-25', '2020-04-01', '2020-04-08', '2020-04-15', '2020-04-22', '2020-04-29', '2020-05-06', '2020-05-13', '2020-05-20', '2020-05-27', '2020-06-03', '2020-06-10', '2020-06-17', '2020-06-24', '2020-07-01', '2020-07-08', '2020-07-15', '2020-07-22', '2020-07-29', '2020-08-05', '2020-08-12', '2020-08-19', '2020-08-26', '2020-09-02', '2020-09-09', '2020-09-16', '2020-09-23'], - timeUnit: 'day', - source: { - type: 'raster', - tiles: [ - `${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/wq-greatlakes-chl/chl_anomaly_greatlakes_{date}.tif&resampling_method=bilinear&bidx=1&rescale=-100%2C100&color_map=rdbu_r` - ] - }, exclusiveWith: ['water-wq-gl-spm'], - swatch: indicatorGroupColors['water-quality'], - legend: { - type: 'gradient', - min: 'less', - max: 'more', - stops: [ - '#3A88BD', - '#C9E0ED', - '#E4EEF3', - '#FDDCC9', - '#DE725B', - '#67001F' - ] - }, + enabled: true, info: 'Chlorophyll is an indicator of algae growth. Redder colors indicate increases in chlorophyll-a and worse water quality. Bluer colors indicate decreases in chlorophyll-a and improved water quality. White areas indicate no change.' }; diff --git a/app/assets/scripts/components/common/layers/layer-wq-gl-spm.js b/app/assets/scripts/components/common/layers/layer-wq-gl-spm.js index caf3278b..b1db8db7 100644 --- a/app/assets/scripts/components/common/layers/layer-wq-gl-spm.js +++ b/app/assets/scripts/components/common/layers/layer-wq-gl-spm.js @@ -1,33 +1,6 @@ -import config from '../../../config'; - -import { indicatorGroupColors } from '../../../styles/theme/theme.js'; - export default { id: 'water-wq-gl-spm', - name: 'Turbidity', - type: 'raster-timeseries', - domain: ['2020-01-01', '2020-01-08', '2020-01-15', '2020-01-22', '2020-01-29', '2020-02-05', '2020-02-12', '2020-02-19', '2020-02-26', '2020-03-04', '2020-03-11', '2020-03-18', '2020-03-25', '2020-04-01', '2020-04-08', '2020-04-15', '2020-04-22', '2020-04-29', '2020-05-06', '2020-05-13', '2020-05-20', '2020-05-27', '2020-06-03', '2020-06-10', '2020-06-17', '2020-06-24', '2020-07-01', '2020-07-08', '2020-07-15', '2020-07-22', '2020-07-29', '2020-08-05', '2020-08-12', '2020-08-19', '2020-08-26', '2020-09-02', '2020-09-09', '2020-09-16', '2020-09-23'], - timeUnit: 'day', - source: { - type: 'raster', - tiles: [ - `${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/wq-greatlakes-sm/sm_anomaly_greatlakes_{date}.tif&resampling_method=bilinear&bidx=1&rescale=-100%2C100&color_map=rdbu_r` - ] - }, exclusiveWith: ['water-wq-gl-chl'], - swatch: indicatorGroupColors['water-quality'], - legend: { - type: 'gradient', - min: 'less', - max: 'more', - stops: [ - '#3A88BD', - '#C9E0ED', - '#E4EEF3', - '#FDDCC9', - '#DE725B', - '#67001F' - ] - }, + enabled: true, info: 'Turbidity refers to the amount of sediment or particles suspended in water. Darker colors indicate more sediment and murkier water. Lighter colors indicate less sediment and clearer water.' }; diff --git a/app/assets/scripts/components/common/layers/types.js b/app/assets/scripts/components/common/layers/types.js index 3e2e5fa1..45fa465d 100644 --- a/app/assets/scripts/components/common/layers/types.js +++ b/app/assets/scripts/components/common/layers/types.js @@ -194,10 +194,9 @@ export const layerTypes = { update: (ctx, layerInfo, prevProps) => { const { props, mbMap } = ctx; const { date } = props; - const { id, source } = layerInfo; + const { id, source, backgroundSource } = layerInfo; const vecId = `${id}-vector`; const rastId = `${id}-raster`; - const { vector, raster } = source; // Do not update if: if ( @@ -211,8 +210,8 @@ export const layerTypes = { if (!mbMap.getSource(vecId) || !mbMap.getSource(rastId)) return; const formatDate = format(utcDate(date), dateFormats[layerInfo.timeUnit]); - const vectorData = vector.data.replace('{date}', formatDate); - const rasterTiles = raster.tiles.map(tile => tile.replace('{date}', formatDate)); + const vectorData = source.data.replace('{date}', formatDate); + const rasterTiles = backgroundSource.tiles.map(tile => tile.replace('{date}', formatDate)); // inference data moves around, recenter on each update fetch(vectorData) @@ -243,10 +242,9 @@ export const layerTypes = { }, show: (ctx, layerInfo) => { const { mbMap } = ctx; - const { id, source, domain } = layerInfo; + const { id, source, backgroundSource, domain } = layerInfo; const vecId = `${id}-vector`; const rastId = `${id}-raster`; - const { vector, raster } = source; const inferPaint = { 'line-color': '#f2a73a', @@ -255,12 +253,12 @@ export const layerTypes = { }; const formatDate = format(utcDate(domain[domain.length - 1]), dateFormats[layerInfo.timeUnit]); const vectorL = { - ...vector, - data: vector.data.replace('{date}', formatDate) + ...source, + data: source.data.replace('{date}', formatDate) }; const rasterL = { - ...raster, - tiles: raster.tiles.map(tile => tile.replace('{date}', formatDate)) + ...backgroundSource, + tiles: backgroundSource.tiles.map(tile => tile.replace('{date}', formatDate)) }; toggleOrAddLayer(mbMap, vecId, vectorL, 'line', inferPaint, 'admin-0-boundary-bg'); diff --git a/app/assets/scripts/components/indicators/indicator-shipping.js b/app/assets/scripts/components/indicators/indicator-shipping.js index 3e0021e3..bc344349 100644 --- a/app/assets/scripts/components/indicators/indicator-shipping.js +++ b/app/assets/scripts/components/indicators/indicator-shipping.js @@ -277,13 +277,13 @@ class ShippingLongForm extends React.Component {
NASA researchers have access to the high-resolution imagery
from Planet Labs, through the Commercial SmallSat Data
- Acquisition Program (
+ Acquisition program (
- CSDAP
+ CSDA
), which acquires data from commercial sources that support
NASA's Earth science research goals. The PlanetScope
@@ -316,7 +316,7 @@ class ShippingLongForm extends React.Component {
- The CSDAP and IMPACT are elements of NASA’s Earth Science Data
+ The CSDA and IMPACT are elements of NASA’s Earth Science Data
Systems program.