From 72a61cf8fdbe29c64390d9f3cc0daa7da6eb062b Mon Sep 17 00:00:00 2001 From: Joe Roberts Date: Thu, 30 May 2024 11:41:38 -0700 Subject: [PATCH 1/2] Added downloadURL variable to allow users to download raster layers #546 --- src/essence/Tools/Layers/LayersTool.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/essence/Tools/Layers/LayersTool.js b/src/essence/Tools/Layers/LayersTool.js index 5fe08e41..87834f6b 100644 --- a/src/essence/Tools/Layers/LayersTool.js +++ b/src/essence/Tools/Layers/LayersTool.js @@ -304,6 +304,21 @@ function interfaceWithMMGIS(fromInit) { layerExport = '' } + // Add download URL for raster layers + if(node[i].hasOwnProperty('variables')) { + if(node[i].variables.hasOwnProperty('downloadURL')) { + layerExport = [ + '', + ].join('\n') + } + } + // Build timeDisplay var timeDisplay = '' if (node[i].time != null) { From 11dac2b6fc83be0f58129198c0dd1625bf52f133 Mon Sep 17 00:00:00 2001 From: Joe Roberts Date: Thu, 13 Jun 2024 19:01:32 -0700 Subject: [PATCH 2/2] Made downloadURL specific to tile and data layers, and updated docs #546 --- docs/pages/Configure/Layers/Data/Data.md | 6 ++++- docs/pages/Configure/Layers/Tile/Tile.md | 2 ++ src/essence/Tools/Layers/LayersTool.js | 33 +++++++++++++----------- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/docs/pages/Configure/Layers/Data/Data.md b/docs/pages/Configure/Layers/Data/Data.md index 4922d0a6..bed7d4f2 100644 --- a/docs/pages/Configure/Layers/Data/Data.md +++ b/docs/pages/Configure/Layers/Data/Data.md @@ -79,6 +79,7 @@ Data layers need a configured `shader` raw variable to be effective. Supported s - ramps: An array of arrays of hex color strings. "transparent" is a special keyword for a fully transparent ramp color. - "image": (Default) Simply shows the underlying raw data in an image form. Mainly for testing, it can also be useful for development for internal pass-tile-canvas-instead-of-url layers. + Example: ```javascript @@ -97,6 +98,9 @@ Example: "#0000FF" ] ] - } + }, + "downloadURL": "(str) url_to_data/data.tif" } ``` + +- `downloadURL`: Provides a menu option for users to download the specified source data file for the layer. diff --git a/docs/pages/Configure/Layers/Tile/Tile.md b/docs/pages/Configure/Layers/Tile/Tile.md index 4ed4ee55..4ca47c08 100644 --- a/docs/pages/Configure/Layers/Tile/Tile.md +++ b/docs/pages/Configure/Layers/Tile/Tile.md @@ -115,6 +115,7 @@ Example: "value_in_response_to_replace_with.use.dot.notation.to.traverse.objects", }, }, + "downloadURL": "(str) url_to_data/data.tif", "tools": { "measure": { "layerDems": [ @@ -141,3 +142,4 @@ Example: - `shortcutSuffix`: A single letter to 'ALT + {letter}' toggle the layer on and off. Please verify that your chosen shortcut does not conflict with other system or browser-level keyboard shortcuts. - `urlReplacements`: For the case where parts or all of a tileset's url comes from intermediary endpoints. For example a service may require sending a query to a server that then returns a uuid and that uuid is required in the tileset's url to query it. +- `downloadURL`: Provides a menu option for users to download the specified source data file for the layer. diff --git a/src/essence/Tools/Layers/LayersTool.js b/src/essence/Tools/Layers/LayersTool.js index 87834f6b..402a072c 100644 --- a/src/essence/Tools/Layers/LayersTool.js +++ b/src/essence/Tools/Layers/LayersTool.js @@ -300,25 +300,28 @@ function interfaceWithMMGIS(fromInit) { '', ].join('\n') break + case 'data': + case 'tile': + layerExport = '' + // Add download URL for raster layers + if(node[i].hasOwnProperty('variables')) { + if(node[i].variables.hasOwnProperty('downloadURL')) { + layerExport = [ + '', + ].join('\n') + } + } + break default: layerExport = '' } - // Add download URL for raster layers - if(node[i].hasOwnProperty('variables')) { - if(node[i].variables.hasOwnProperty('downloadURL')) { - layerExport = [ - '', - ].join('\n') - } - } - // Build timeDisplay var timeDisplay = '' if (node[i].time != null) {