Skip to content

Commit

Permalink
#462 IdentifierTool - Query Datasets with Time
Browse files Browse the repository at this point in the history
  • Loading branch information
tariqksoliman committed Dec 6, 2023
1 parent c0f7a35 commit 1e10565
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/essence/Tools/Identifier/IdentifierTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,30 @@ var IdentifierTool = {
destroy: function () {
this.MMWebGISInterface.separateFromMMWebGIS()
},
fillURLParameters: function (url, layerUUID) {
if (IdentifierTool.vars[layerUUID]) {
const layerTimeFormat = d3.utcFormat(
IdentifierTool.vars[layerUUID].timeFormat
)

let filledURL = url
filledURL = filledURL
.replace(
/{starttime}/g,
layerTimeFormat(
Date.parse(L_.layers.data[layerUUID].time.start)
)
)
.replace(
/{endtime}/g,
layerTimeFormat(
Date.parse(L_.layers.data[layerUUID].time.end)
)
)

return filledURL
} else return url
},
//From: https://github.com/mrdoob/three.js/issues/758 mrdoob
getImageData: function (image) {
if (image.width == 0) return
Expand Down Expand Up @@ -240,6 +264,7 @@ var IdentifierTool = {
lnglatzoom[1],
IdentifierTool.vars[IdentifierTool.activeLayerNames[i]]
.bands,
IdentifierTool.activeLayerNames[i],
(function (pxRGBA, i) {
return function (value) {
var htmlValues = ''
Expand Down Expand Up @@ -442,14 +467,17 @@ function bestMatchInLegend(rgba, legendData) {
return bestMatch
}

function queryDataValue(url, lng, lat, numBands, callback) {
function queryDataValue(url, lng, lat, numBands, layerUUID, callback) {
numBands = numBands || 1
var dataPath
if (url.startsWith('/vsicurl/')) {
dataPath = url
} else {
dataPath = 'Missions/' + L_.mission + '/' + url
}

dataPath = IdentifierTool.fillURLParameters(dataPath, layerUUID)

calls.api(
'getbands',
{
Expand Down

0 comments on commit 1e10565

Please sign in to comment.