Skip to content

Commit

Permalink
Identifier tool vsicurl support (#444)
Browse files Browse the repository at this point in the history
* IdentifierTool: do not modify data path if it is an external vsicurl URI

* API: getprofile and getbands return 400 and log the error if backend script fails.

---------

Co-authored-by: Schiewe, Evan A. (ARC-TI)[KBR Wyle Services, LLC] <[email protected]>
  • Loading branch information
Wieschie and Schiewe, Evan A. (ARC-TI)[KBR Wyle Services, LLC] authored Oct 24, 2023
1 parent c0741cf commit 27def3c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
16 changes: 14 additions & 2 deletions scripts/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,13 @@ setups.getBackendSetups(function (setups) {
1,
],
function (error, stdout, stderr) {
res.send(stdout);
if (error) {
logger("warn", error)
res.status(400).send();
}
else {
res.send(stdout);
}
}
);
}
Expand All @@ -677,7 +683,13 @@ setups.getBackendSetups(function (setups) {
"python",
["private/api/BandsToProfile.py", path, x, y, xyorll, bands],
function (error, stdout, stderr) {
res.send(stdout);
if (error) {
logger("warn", error)
res.status(400).send();
}
else {
res.send(stdout);
}
}
);
}
Expand Down
9 changes: 8 additions & 1 deletion src/essence/Tools/Identifier/IdentifierTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,13 @@ function bestMatchInLegend(rgba, legendData) {

function queryDataValue(url, lng, lat, numBands, callback) {
numBands = numBands || 1
var dataPath
if (url.startsWith("/vsicurl/")) {
dataPath = url
}
else {
dataPath = 'Missions/' + L_.mission + '/' + url
}
calls.api(
'getbands',
{
Expand All @@ -447,7 +454,7 @@ function queryDataValue(url, lng, lat, numBands, callback) {
y: lng,
xyorll: 'll',
bands: '[[1,' + numBands + ']]',
path: 'Missions/' + L_.mission + '/' + url,
path: dataPath,
},
function (data) {
//Convert python's Nones to nulls
Expand Down

0 comments on commit 27def3c

Please sign in to comment.