Skip to content

Commit

Permalink
Merge pull request #547 from NASA-AMMOS/jr-546
Browse files Browse the repository at this point in the history
Added downloadURL variable to allow users to download raster layers #546
  • Loading branch information
jtroberts authored Jun 17, 2024
2 parents e97d9be + 11dac2b commit 6864ba0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docs/pages/Configure/Layers/Data/Data.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
2 changes: 2 additions & 0 deletions docs/pages/Configure/Layers/Tile/Tile.md
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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.
18 changes: 18 additions & 0 deletions src/essence/Tools/Layers/LayersTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,24 @@ function interfaceWithMMGIS(fromInit) {
'</ul>',
].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 = [
'<ul>',
'<li>',
'<div class="layersToolExportSourceGeoJSON">',
`<div><a href="` + node[i].variables.downloadURL + `" target="_blank">Download Data</a></div>`,
'</div>',
'</li>',
'</ul>',
].join('\n')
}
}
break
default:
layerExport = ''
}
Expand Down

0 comments on commit 6864ba0

Please sign in to comment.