From 6140ca642b485d80d9174b7bcbc413cd8387a9c8 Mon Sep 17 00:00:00 2001 From: PatchesMaps Date: Tue, 14 May 2024 15:02:16 -0400 Subject: [PATCH 1/7] first pass --- .../common/config/wv.json/layerOrder.json | 1 + .../ghgc/GGC_Net_Primary_Production.json | 23 ++++++++ .../release/config/wv.json/sources.json | 3 ++ .../GHGC_Net_Primary_Produnction.jpg | 6 +++ web/js/map/layerbuilder.js | 52 +++++++++++++------ 5 files changed, 68 insertions(+), 17 deletions(-) create mode 100644 config/default/common/config/wv.json/layers/ghgc/GGC_Net_Primary_Production.json create mode 100644 web/images/layers/previews/geographic/GHGC_Net_Primary_Produnction.jpg diff --git a/config/default/common/config/wv.json/layerOrder.json b/config/default/common/config/wv.json/layerOrder.json index e08949a6af..5b64592b2b 100644 --- a/config/default/common/config/wv.json/layerOrder.json +++ b/config/default/common/config/wv.json/layerOrder.json @@ -1,5 +1,6 @@ { "layerOrder": [ + "GHGC_Net_Primary_Produnction", "HLS_S30_Nadir_BRDF_Adjusted_Reflectance", "HLS_L30_Nadir_BRDF_Adjusted_Reflectance", "HLS_Customizable_Landsat", diff --git a/config/default/common/config/wv.json/layers/ghgc/GGC_Net_Primary_Production.json b/config/default/common/config/wv.json/layers/ghgc/GGC_Net_Primary_Production.json new file mode 100644 index 0000000000..18db357165 --- /dev/null +++ b/config/default/common/config/wv.json/layers/ghgc/GGC_Net_Primary_Production.json @@ -0,0 +1,23 @@ +{ + "layers": { + "GHGC_Net_Primary_Produnction": { + "id": "GHGC_Net_Primary_Produnction", + "layerName": "npp", + "title": "Net Primary Production", + "subtitle": "U.S. Greenhouse Gas Center", + "description": "ghgc/Net_Primary_Produnction", + "tags": "ghgc npp", + "group": "overlays", + "layergroup": "Reference", + "format": "image/png", + "type": "ttiler", + "disableSnapshot": true, + "wrapX": true, + "projections": { + "geographic": { + "source": "GHGC:geographic" + } + } + } + } + } \ No newline at end of file diff --git a/config/default/release/config/wv.json/sources.json b/config/default/release/config/wv.json/sources.json index c9c3337d0f..dd9f43bf95 100644 --- a/config/default/release/config/wv.json/sources.json +++ b/config/default/release/config/wv.json/sources.json @@ -24,6 +24,9 @@ "FIRMS:xyz": { "url": "https://firms.modaps.eosdis.nasa.gov/layers" }, + "GHGC:geographic": { + "url": "https://ghg.center/api/raster/mosaic/3b46d29dcb49fd2eb8e4a65b5dcde805" + }, "DDV": { "url": "https://kv9drwgv6l.execute-api.us-west-2.amazonaws.com/", "matrixSets": { diff --git a/web/images/layers/previews/geographic/GHGC_Net_Primary_Produnction.jpg b/web/images/layers/previews/geographic/GHGC_Net_Primary_Produnction.jpg new file mode 100644 index 0000000000..7d9c05ee4f --- /dev/null +++ b/web/images/layers/previews/geographic/GHGC_Net_Primary_Produnction.jpg @@ -0,0 +1,6 @@ + + + +msWMSLoadGetMapParams(): WMS server error. Invalid layer(s) given in the LAYERS parameter. A layer might be disabled for this request. Check wms/ows_enable_request settings. + + diff --git a/web/js/map/layerbuilder.js b/web/js/map/layerbuilder.js index 003002b0e5..456f4dd0df 100644 --- a/web/js/map/layerbuilder.js +++ b/web/js/map/layerbuilder.js @@ -54,15 +54,15 @@ export default function mapLayerBuilder(config, cache, store) { * @param {*} attributes * @param {*} wrapLayer */ - const getLayer = (createLayerFunc, def, options, attributes, wrapLayer) => { + const getLayer = async (createLayerFunc, def, options, attributes, wrapLayer) => { const state = store.getState(); - const layer = createLayerFunc(def, options, null, state, attributes); + const layer = await createLayerFunc(def, options, null, state, attributes); layer.wv = attributes; if (!wrapLayer) { return layer; } - const layerNext = createLayerFunc(def, options, 1, state, attributes); - const layerPrior = createLayerFunc(def, options, -1, state, attributes); + const layerNext = await createLayerFunc(def, options, 1, state, attributes); + const layerPrior = await createLayerFunc(def, options, -1, state, attributes); layerPrior.wv = attributes; layerNext.wv = attributes; @@ -679,16 +679,13 @@ export default function mapLayerBuilder(config, cache, store) { return name; }; - const createTtilerLayer = async (def, options, day, state) => { - const { proj: { selected }, date } = state; - const { maxExtent, crs } = selected; - const { r, g, b } = def.bandCombo; - + const buildDdvTileUrlFunction = async (def, options, state) => { const source = config.sources[def.source]; - + const { r, g, b } = def.bandCombo; + const searchID = await registerSearch(def, options, state); - const tileUrlFunction = (tileCoord) => { + return (tileCoord) => { const z = tileCoord[0] - 1; const x = tileCoord[1]; const y = tileCoord[2]; @@ -703,8 +700,29 @@ export default function mapLayerBuilder(config, cache, store) { const urlParams = `mosaic/tiles/${searchID}/WGS1984Quad/${z}/${x}/${y}@1x?post_process=swir&${params.filter((p) => !p.split('=').includes('undefined')).join('&')}`; - return source.url + urlParams; + return `${source.url}${urlParams}`; + }; + }; + + const buildGhgcTileUrlFunction = (def) => { + const source = config.sources[def.source]; + + return (tileCoord) => { + const z = tileCoord[0] - 1; + const x = tileCoord[1]; + const y = tileCoord[2]; + + const urlParams = `tiles/WGS1984Quad/${z}/${x}/${y}?assets=${def.layerName}&colormap_name=purd&rescale=0%2C0.3` + + return `${source.url}/${urlParams}`; }; + }; + + const createTtilerLayer = async (def, options, day, state) => { + const { proj: { selected }, date } = state; + const { maxExtent, crs } = selected; + + const tileUrlFunction = def.source === 'DDV' ? await buildDdvTileUrlFunction(def, options, state) : buildGhgcTileUrlFunction(def); const xyzSourceOptions = { crossOrigin: 'anonymous', @@ -720,7 +738,7 @@ export default function mapLayerBuilder(config, cache, store) { const layer = new OlLayerTile({ source: xyzSource, className, - minZoom: def.minZoom, + minZoom: def.minZoom || 0, extent: maxExtent, }); @@ -816,19 +834,19 @@ export default function mapLayerBuilder(config, cache, store) { if (!isGranule) { switch (def.type) { case 'wmts': - layer = getLayer(createLayerWMTS, def, options, attributes, wrapLayer); + layer = await getLayer(createLayerWMTS, def, options, attributes, wrapLayer); break; case 'vector': - layer = getLayer(createLayerVector, def, options, attributes, wrapLayer); + layer = await getLayer(createLayerVector, def, options, attributes, wrapLayer); break; case 'wms': - layer = getLayer(createLayerWMS, def, options, attributes, wrapLayer); + layer = await getLayer(createLayerWMS, def, options, attributes, wrapLayer); break; case 'ttiler': layer = await getLayer(createTtilerLayer, def, options, attributes, wrapLayer); break; case 'xyz': - layer = getLayer(createXYZLayer, def, options, attributes, wrapLayer); + layer = await getLayer(createXYZLayer, def, options, attributes, wrapLayer); break; default: throw new Error(`Unknown layer type: ${type}`); From faef38b833664141ecfe23749cd8816a3c89135b Mon Sep 17 00:00:00 2001 From: PatchesMaps Date: Tue, 14 May 2024 15:04:50 -0400 Subject: [PATCH 2/7] lint --- web/js/map/layerbuilder.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/js/map/layerbuilder.js b/web/js/map/layerbuilder.js index 456f4dd0df..bb66295ec0 100644 --- a/web/js/map/layerbuilder.js +++ b/web/js/map/layerbuilder.js @@ -682,7 +682,7 @@ export default function mapLayerBuilder(config, cache, store) { const buildDdvTileUrlFunction = async (def, options, state) => { const source = config.sources[def.source]; const { r, g, b } = def.bandCombo; - + const searchID = await registerSearch(def, options, state); return (tileCoord) => { @@ -712,7 +712,7 @@ export default function mapLayerBuilder(config, cache, store) { const x = tileCoord[1]; const y = tileCoord[2]; - const urlParams = `tiles/WGS1984Quad/${z}/${x}/${y}?assets=${def.layerName}&colormap_name=purd&rescale=0%2C0.3` + const urlParams = `tiles/WGS1984Quad/${z}/${x}/${y}?assets=${def.layerName}&colormap_name=purd&rescale=0%2C0.3`; return `${source.url}/${urlParams}`; }; From f3addf51bdc11b4cc52c91109dc109a88a7bb6ee Mon Sep 17 00:00:00 2001 From: PatchesMaps Date: Tue, 14 May 2024 16:14:44 -0400 Subject: [PATCH 3/7] ggc to ghgc --- ...t_Primary_Production.json => GHGC_Net_Primary_Production.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename config/default/common/config/wv.json/layers/ghgc/{GGC_Net_Primary_Production.json => GHGC_Net_Primary_Production.json} (100%) diff --git a/config/default/common/config/wv.json/layers/ghgc/GGC_Net_Primary_Production.json b/config/default/common/config/wv.json/layers/ghgc/GHGC_Net_Primary_Production.json similarity index 100% rename from config/default/common/config/wv.json/layers/ghgc/GGC_Net_Primary_Production.json rename to config/default/common/config/wv.json/layers/ghgc/GHGC_Net_Primary_Production.json From 05503272c54d946dd53f7f5ef2052bf82294769f Mon Sep 17 00:00:00 2001 From: PatchesMaps Date: Tue, 14 May 2024 17:16:49 -0400 Subject: [PATCH 4/7] titiler --- .../config/wv.json/layers/ghgc/GHGC_Net_Primary_Production.json | 2 +- web/js/map/layerbuilder.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/default/common/config/wv.json/layers/ghgc/GHGC_Net_Primary_Production.json b/config/default/common/config/wv.json/layers/ghgc/GHGC_Net_Primary_Production.json index 18db357165..48b237c4c4 100644 --- a/config/default/common/config/wv.json/layers/ghgc/GHGC_Net_Primary_Production.json +++ b/config/default/common/config/wv.json/layers/ghgc/GHGC_Net_Primary_Production.json @@ -10,7 +10,7 @@ "group": "overlays", "layergroup": "Reference", "format": "image/png", - "type": "ttiler", + "type": "titiler", "disableSnapshot": true, "wrapX": true, "projections": { diff --git a/web/js/map/layerbuilder.js b/web/js/map/layerbuilder.js index 4b9143258f..9b077e6054 100644 --- a/web/js/map/layerbuilder.js +++ b/web/js/map/layerbuilder.js @@ -718,7 +718,7 @@ export default function mapLayerBuilder(config, cache, store) { }; }; - const createTtilerLayer = async (def, options, day, state) => { + const createTitilerLayer = async (def, options, day, state) => { const { proj: { selected }, date } = state; const { maxExtent, crs } = selected; From 854948de2de58525a746813934948e417baffed1 Mon Sep 17 00:00:00 2001 From: PatchesMaps Date: Wed, 15 May 2024 14:20:48 -0400 Subject: [PATCH 5/7] more layers --- .../common/config/wv.json/layerOrder.json | 4 ++ .../layers/ghgc/GHGC_Fire_Emissions.json | 27 +++++++ .../ghgc/GHGC_Heterotrophic_Respiration.json | 27 +++++++ .../ghgc/GHGC_Net_Ecosystem_Exchange.json | 27 +++++++ .../ghgc/GHGC_Net_Primary_Production.json | 6 +- .../layers/ghgc/GHGC_Wood_Fuel_Emissions.json | 27 +++++++ .../release/config/wv.json/sources.json | 2 +- .../geographic/GHGC_Fire_Emissions.jpg | 6 ++ .../GHGC_Heterotrophic_Respiration.jpg | 6 ++ .../GHGC_Net_Ecosystem_Exchange.jpg | 6 ++ .../geographic/GHGC_Wood_Fuel_Emissions.jpg | 6 ++ web/js/map/layerbuilder.js | 70 +++++++++++++++++-- 12 files changed, 207 insertions(+), 7 deletions(-) create mode 100644 config/default/common/config/wv.json/layers/ghgc/GHGC_Fire_Emissions.json create mode 100644 config/default/common/config/wv.json/layers/ghgc/GHGC_Heterotrophic_Respiration.json create mode 100644 config/default/common/config/wv.json/layers/ghgc/GHGC_Net_Ecosystem_Exchange.json create mode 100644 config/default/common/config/wv.json/layers/ghgc/GHGC_Wood_Fuel_Emissions.json create mode 100644 web/images/layers/previews/geographic/GHGC_Fire_Emissions.jpg create mode 100644 web/images/layers/previews/geographic/GHGC_Heterotrophic_Respiration.jpg create mode 100644 web/images/layers/previews/geographic/GHGC_Net_Ecosystem_Exchange.jpg create mode 100644 web/images/layers/previews/geographic/GHGC_Wood_Fuel_Emissions.jpg diff --git a/config/default/common/config/wv.json/layerOrder.json b/config/default/common/config/wv.json/layerOrder.json index 5b64592b2b..385a1368f5 100644 --- a/config/default/common/config/wv.json/layerOrder.json +++ b/config/default/common/config/wv.json/layerOrder.json @@ -1,6 +1,10 @@ { "layerOrder": [ "GHGC_Net_Primary_Produnction", + "GHGC_Heterotrophic_Respiration", + "GHGC_Net_Ecosystem_Exchange", + "GHGC_Fire_Emissions", + "GHGC_Wood_Fuel_Emissions", "HLS_S30_Nadir_BRDF_Adjusted_Reflectance", "HLS_L30_Nadir_BRDF_Adjusted_Reflectance", "HLS_Customizable_Landsat", diff --git a/config/default/common/config/wv.json/layers/ghgc/GHGC_Fire_Emissions.json b/config/default/common/config/wv.json/layers/ghgc/GHGC_Fire_Emissions.json new file mode 100644 index 0000000000..7801e5fe3a --- /dev/null +++ b/config/default/common/config/wv.json/layers/ghgc/GHGC_Fire_Emissions.json @@ -0,0 +1,27 @@ +{ + "layers": { + "GHGC_Fire_Emissions": { + "id": "GHGC_Fire_Emissions", + "layerName": "fire", + "title": "Fire Emissions", + "subtitle": "U.S. Greenhouse Gas Center", + "description": "ghgc/Fire_Emissions", + "tags": "ghgc fire", + "group": "overlays", + "layergroup": "Reference", + "format": "image/png", + "type": "titiler", + "disableSnapshot": true, + "wrapX": true, + "colormapName": "purd", + "rescale": "0,0.3", + "projections": { + "geographic": { + "source": "GHGC:geographic" + } + }, + "startDate": "2003-01-01T00:00:00Z", + "endDate": "2017-12-31T23:59:59Z" + } + } + } \ No newline at end of file diff --git a/config/default/common/config/wv.json/layers/ghgc/GHGC_Heterotrophic_Respiration.json b/config/default/common/config/wv.json/layers/ghgc/GHGC_Heterotrophic_Respiration.json new file mode 100644 index 0000000000..e55647da27 --- /dev/null +++ b/config/default/common/config/wv.json/layers/ghgc/GHGC_Heterotrophic_Respiration.json @@ -0,0 +1,27 @@ +{ + "layers": { + "GHGC_Heterotrophic_Respiration": { + "id": "GHGC_Heterotrophic_Respiration", + "layerName": "rh", + "title": "Heterotrophic Respiration", + "subtitle": "U.S. Greenhouse Gas Center", + "description": "ghgc/Heterotrophic_Respiration", + "tags": "ghgc rh", + "group": "overlays", + "layergroup": "Reference", + "format": "image/png", + "type": "titiler", + "disableSnapshot": true, + "wrapX": true, + "colormapName": "purd", + "rescale": "0,0.3", + "projections": { + "geographic": { + "source": "GHGC:geographic" + } + }, + "startDate": "2003-01-01T00:00:00Z", + "endDate": "2017-12-31T23:59:59Z" + } + } + } \ No newline at end of file diff --git a/config/default/common/config/wv.json/layers/ghgc/GHGC_Net_Ecosystem_Exchange.json b/config/default/common/config/wv.json/layers/ghgc/GHGC_Net_Ecosystem_Exchange.json new file mode 100644 index 0000000000..a300fcea80 --- /dev/null +++ b/config/default/common/config/wv.json/layers/ghgc/GHGC_Net_Ecosystem_Exchange.json @@ -0,0 +1,27 @@ +{ + "layers": { + "GHGC_Net_Ecosystem_Exchange": { + "id": "GHGC_Net_Ecosystem_Exchange", + "layerName": "nee", + "title": "Net Ecosystem Exchange", + "subtitle": "U.S. Greenhouse Gas Center", + "description": "ghgc/Net_Ecosystem_Exchange", + "tags": "ghgc nee", + "group": "overlays", + "layergroup": "Reference", + "format": "image/png", + "type": "titiler", + "disableSnapshot": true, + "wrapX": true, + "colormapName": "coolwarm", + "rescale": "-0.1,0.1", + "projections": { + "geographic": { + "source": "GHGC:geographic" + } + }, + "startDate": "2003-01-01T00:00:00Z", + "endDate": "2017-12-31T23:59:59Z" + } + } + } \ No newline at end of file diff --git a/config/default/common/config/wv.json/layers/ghgc/GHGC_Net_Primary_Production.json b/config/default/common/config/wv.json/layers/ghgc/GHGC_Net_Primary_Production.json index 48b237c4c4..df9285088b 100644 --- a/config/default/common/config/wv.json/layers/ghgc/GHGC_Net_Primary_Production.json +++ b/config/default/common/config/wv.json/layers/ghgc/GHGC_Net_Primary_Production.json @@ -13,11 +13,15 @@ "type": "titiler", "disableSnapshot": true, "wrapX": true, + "colormapName": "purd", + "rescale": "0,0.3", "projections": { "geographic": { "source": "GHGC:geographic" } - } + }, + "startDate": "2003-01-01T00:00:00Z", + "endDate": "2017-12-31T23:59:59Z" } } } \ No newline at end of file diff --git a/config/default/common/config/wv.json/layers/ghgc/GHGC_Wood_Fuel_Emissions.json b/config/default/common/config/wv.json/layers/ghgc/GHGC_Wood_Fuel_Emissions.json new file mode 100644 index 0000000000..32fd63f27b --- /dev/null +++ b/config/default/common/config/wv.json/layers/ghgc/GHGC_Wood_Fuel_Emissions.json @@ -0,0 +1,27 @@ +{ + "layers": { + "GHGC_Wood_Fuel_Emissions": { + "id": "GHGC_Wood_Fuel_Emissions", + "layerName": "fuel", + "title": "Wood Fuel Emissions", + "subtitle": "U.S. Greenhouse Gas Center", + "description": "ghgc/Wood_Fuel_Emissions", + "tags": "ghgc fuel", + "group": "overlays", + "layergroup": "Reference", + "format": "image/png", + "type": "titiler", + "disableSnapshot": true, + "wrapX": true, + "colormapName": "bupu", + "rescale": "0,0.03", + "projections": { + "geographic": { + "source": "GHGC:geographic" + } + }, + "startDate": "2003-01-01T00:00:00Z", + "endDate": "2017-12-31T23:59:59Z" + } + } + } \ No newline at end of file diff --git a/config/default/release/config/wv.json/sources.json b/config/default/release/config/wv.json/sources.json index dd9f43bf95..c6c0295166 100644 --- a/config/default/release/config/wv.json/sources.json +++ b/config/default/release/config/wv.json/sources.json @@ -25,7 +25,7 @@ "url": "https://firms.modaps.eosdis.nasa.gov/layers" }, "GHGC:geographic": { - "url": "https://ghg.center/api/raster/mosaic/3b46d29dcb49fd2eb8e4a65b5dcde805" + "url": "https://ghg.center/api/raster/mosaic" }, "DDV": { "url": "https://kv9drwgv6l.execute-api.us-west-2.amazonaws.com/", diff --git a/web/images/layers/previews/geographic/GHGC_Fire_Emissions.jpg b/web/images/layers/previews/geographic/GHGC_Fire_Emissions.jpg new file mode 100644 index 0000000000..7d9c05ee4f --- /dev/null +++ b/web/images/layers/previews/geographic/GHGC_Fire_Emissions.jpg @@ -0,0 +1,6 @@ + + + +msWMSLoadGetMapParams(): WMS server error. Invalid layer(s) given in the LAYERS parameter. A layer might be disabled for this request. Check wms/ows_enable_request settings. + + diff --git a/web/images/layers/previews/geographic/GHGC_Heterotrophic_Respiration.jpg b/web/images/layers/previews/geographic/GHGC_Heterotrophic_Respiration.jpg new file mode 100644 index 0000000000..7d9c05ee4f --- /dev/null +++ b/web/images/layers/previews/geographic/GHGC_Heterotrophic_Respiration.jpg @@ -0,0 +1,6 @@ + + + +msWMSLoadGetMapParams(): WMS server error. Invalid layer(s) given in the LAYERS parameter. A layer might be disabled for this request. Check wms/ows_enable_request settings. + + diff --git a/web/images/layers/previews/geographic/GHGC_Net_Ecosystem_Exchange.jpg b/web/images/layers/previews/geographic/GHGC_Net_Ecosystem_Exchange.jpg new file mode 100644 index 0000000000..7d9c05ee4f --- /dev/null +++ b/web/images/layers/previews/geographic/GHGC_Net_Ecosystem_Exchange.jpg @@ -0,0 +1,6 @@ + + + +msWMSLoadGetMapParams(): WMS server error. Invalid layer(s) given in the LAYERS parameter. A layer might be disabled for this request. Check wms/ows_enable_request settings. + + diff --git a/web/images/layers/previews/geographic/GHGC_Wood_Fuel_Emissions.jpg b/web/images/layers/previews/geographic/GHGC_Wood_Fuel_Emissions.jpg new file mode 100644 index 0000000000..7d9c05ee4f --- /dev/null +++ b/web/images/layers/previews/geographic/GHGC_Wood_Fuel_Emissions.jpg @@ -0,0 +1,6 @@ + + + +msWMSLoadGetMapParams(): WMS server error. Invalid layer(s) given in the LAYERS parameter. A layer might be disabled for this request. Check wms/ows_enable_request settings. + + diff --git a/web/js/map/layerbuilder.js b/web/js/map/layerbuilder.js index 9b077e6054..2a77927907 100644 --- a/web/js/map/layerbuilder.js +++ b/web/js/map/layerbuilder.js @@ -593,7 +593,7 @@ export default function mapLayerBuilder(config, cache, store) { return layer; }; - const registerSearch = async (def, options, state) => { + const registerSearchDDV = async (def, options, state) => { const { date } = state; let requestDate; if (options.group === 'activeB') { @@ -683,7 +683,7 @@ export default function mapLayerBuilder(config, cache, store) { const source = config.sources[def.source]; const { r, g, b } = def.bandCombo; - const searchID = await registerSearch(def, options, state); + const searchID = await registerSearchDDV(def, options, state); return (tileCoord) => { const z = tileCoord[0] - 1; @@ -704,15 +704,75 @@ export default function mapLayerBuilder(config, cache, store) { }; }; - const buildGhgcTileUrlFunction = (def) => { + const registerSearchGHGC = async (def, options, state) => { + const { date } = state; + let requestDate; + if (options.group === 'activeB') { + requestDate = date.selectedB; + } else { + requestDate = date.selected; + } + + const formattedDate = util.toISOStringSeconds(requestDate).slice(0, 10); + const layerID = def.id; + const BASE_URL = 'https://ghg.center/api/raster'; + const collectionID = def.layerName; + const temporalRange = [`${formattedDate}T00:00:00Z`, `${formattedDate}T23:59:59Z`]; + + const collectionsFilter = { + op: 'eq', + args: [{ property: 'collection' }, 'casagfed-carbonflux-monthgrid-v3'], + }; + + const temporalFilter = { + op: 't_intersects', + args: [{ property: 'datetime' }, { interval: temporalRange }], + }; + + const searchBody = { + 'filter-lang': 'cql2-json', + filter: { + op: 'and', + args: [ + collectionsFilter, + temporalFilter, + ], + }, + }; + + const registerResponse = await fetch(`${BASE_URL}/mosaic/register`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(searchBody), + }); + const registerResponseJSON = await registerResponse.json(); + console.log(registerResponseJSON); + + const tilesHref = registerResponseJSON.links?.find((link) => link.rel === 'tilejson',).href; + console.log(tilesHref); + + const tilejsonResponse = await fetch(`${tilesHref}?assets=${def.layerName}&colormap_name=${def.colormapName}&rescale=${encodeURI(def.rescale)}`); + const tilejsonResponseJSON = await tilejsonResponse.json(); + console.log(tilejsonResponseJSON); + + const { name } = tilejsonResponseJSON; + + return name; + }; + + const buildGhgcTileUrlFunction = async (def, options, state) => { const source = config.sources[def.source]; + const searchID = await registerSearchGHGC(def, options, state); + return (tileCoord) => { const z = tileCoord[0] - 1; const x = tileCoord[1]; const y = tileCoord[2]; - const urlParams = `tiles/WGS1984Quad/${z}/${x}/${y}?assets=${def.layerName}&colormap_name=purd&rescale=0%2C0.3`; + const urlParams = `${searchID}/tiles/WGS1984Quad/${z}/${x}/${y}?assets=${def.layerName}&colormap_name=${def.colormapName}&rescale=${encodeURI(def.rescale)}`; return `${source.url}/${urlParams}`; }; @@ -722,7 +782,7 @@ export default function mapLayerBuilder(config, cache, store) { const { proj: { selected }, date } = state; const { maxExtent, crs } = selected; - const tileUrlFunction = def.source === 'DDV' ? await buildDdvTileUrlFunction(def, options, state) : buildGhgcTileUrlFunction(def); + const tileUrlFunction = def.source === 'DDV' ? await buildDdvTileUrlFunction(def, options, state) : await buildGhgcTileUrlFunction(def, options, state); const xyzSourceOptions = { crossOrigin: 'anonymous', From 7aa95cc9b3d90c814eeddb155acc1316775e4555 Mon Sep 17 00:00:00 2001 From: PatchesMaps Date: Wed, 15 May 2024 14:25:00 -0400 Subject: [PATCH 6/7] lint --- web/js/map/layerbuilder.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/web/js/map/layerbuilder.js b/web/js/map/layerbuilder.js index 2a77927907..eeb3455da8 100644 --- a/web/js/map/layerbuilder.js +++ b/web/js/map/layerbuilder.js @@ -714,9 +714,7 @@ export default function mapLayerBuilder(config, cache, store) { } const formattedDate = util.toISOStringSeconds(requestDate).slice(0, 10); - const layerID = def.id; const BASE_URL = 'https://ghg.center/api/raster'; - const collectionID = def.layerName; const temporalRange = [`${formattedDate}T00:00:00Z`, `${formattedDate}T23:59:59Z`]; const collectionsFilter = { @@ -748,14 +746,11 @@ export default function mapLayerBuilder(config, cache, store) { body: JSON.stringify(searchBody), }); const registerResponseJSON = await registerResponse.json(); - console.log(registerResponseJSON); - const tilesHref = registerResponseJSON.links?.find((link) => link.rel === 'tilejson',).href; - console.log(tilesHref); + const tilesHref = registerResponseJSON.links?.find((link) => link.rel === 'tilejson').href; const tilejsonResponse = await fetch(`${tilesHref}?assets=${def.layerName}&colormap_name=${def.colormapName}&rescale=${encodeURI(def.rescale)}`); const tilejsonResponseJSON = await tilejsonResponse.json(); - console.log(tilejsonResponseJSON); const { name } = tilejsonResponseJSON; From 220704b6e64d1be47eada011b20f1c12dc99ab08 Mon Sep 17 00:00:00 2001 From: PatchesMaps Date: Thu, 16 May 2024 09:35:49 -0400 Subject: [PATCH 7/7] monthly --- .../common/config/wv.json/layers/ghgc/GHGC_Fire_Emissions.json | 1 + .../wv.json/layers/ghgc/GHGC_Heterotrophic_Respiration.json | 1 + .../config/wv.json/layers/ghgc/GHGC_Net_Ecosystem_Exchange.json | 1 + .../config/wv.json/layers/ghgc/GHGC_Net_Primary_Production.json | 1 + .../config/wv.json/layers/ghgc/GHGC_Wood_Fuel_Emissions.json | 1 + 5 files changed, 5 insertions(+) diff --git a/config/default/common/config/wv.json/layers/ghgc/GHGC_Fire_Emissions.json b/config/default/common/config/wv.json/layers/ghgc/GHGC_Fire_Emissions.json index 7801e5fe3a..fccc26cf30 100644 --- a/config/default/common/config/wv.json/layers/ghgc/GHGC_Fire_Emissions.json +++ b/config/default/common/config/wv.json/layers/ghgc/GHGC_Fire_Emissions.json @@ -15,6 +15,7 @@ "wrapX": true, "colormapName": "purd", "rescale": "0,0.3", + "period": "monthly", "projections": { "geographic": { "source": "GHGC:geographic" diff --git a/config/default/common/config/wv.json/layers/ghgc/GHGC_Heterotrophic_Respiration.json b/config/default/common/config/wv.json/layers/ghgc/GHGC_Heterotrophic_Respiration.json index e55647da27..a347eb92cc 100644 --- a/config/default/common/config/wv.json/layers/ghgc/GHGC_Heterotrophic_Respiration.json +++ b/config/default/common/config/wv.json/layers/ghgc/GHGC_Heterotrophic_Respiration.json @@ -15,6 +15,7 @@ "wrapX": true, "colormapName": "purd", "rescale": "0,0.3", + "period": "monthly", "projections": { "geographic": { "source": "GHGC:geographic" diff --git a/config/default/common/config/wv.json/layers/ghgc/GHGC_Net_Ecosystem_Exchange.json b/config/default/common/config/wv.json/layers/ghgc/GHGC_Net_Ecosystem_Exchange.json index a300fcea80..d7ea059474 100644 --- a/config/default/common/config/wv.json/layers/ghgc/GHGC_Net_Ecosystem_Exchange.json +++ b/config/default/common/config/wv.json/layers/ghgc/GHGC_Net_Ecosystem_Exchange.json @@ -15,6 +15,7 @@ "wrapX": true, "colormapName": "coolwarm", "rescale": "-0.1,0.1", + "period": "monthly", "projections": { "geographic": { "source": "GHGC:geographic" diff --git a/config/default/common/config/wv.json/layers/ghgc/GHGC_Net_Primary_Production.json b/config/default/common/config/wv.json/layers/ghgc/GHGC_Net_Primary_Production.json index df9285088b..df3e09c661 100644 --- a/config/default/common/config/wv.json/layers/ghgc/GHGC_Net_Primary_Production.json +++ b/config/default/common/config/wv.json/layers/ghgc/GHGC_Net_Primary_Production.json @@ -15,6 +15,7 @@ "wrapX": true, "colormapName": "purd", "rescale": "0,0.3", + "period": "monthly", "projections": { "geographic": { "source": "GHGC:geographic" diff --git a/config/default/common/config/wv.json/layers/ghgc/GHGC_Wood_Fuel_Emissions.json b/config/default/common/config/wv.json/layers/ghgc/GHGC_Wood_Fuel_Emissions.json index 32fd63f27b..64713bff4f 100644 --- a/config/default/common/config/wv.json/layers/ghgc/GHGC_Wood_Fuel_Emissions.json +++ b/config/default/common/config/wv.json/layers/ghgc/GHGC_Wood_Fuel_Emissions.json @@ -15,6 +15,7 @@ "wrapX": true, "colormapName": "bupu", "rescale": "0,0.03", + "period": "monthly", "projections": { "geographic": { "source": "GHGC:geographic"