Skip to content

Commit 9fe0e43

Browse files
authored
Fix image layer url path (#662)
* Fix image layer url path * Make suggested fix
1 parent c91e9d2 commit 9fe0e43

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/essence/Basics/Map_/Map_.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,8 +1447,13 @@ function makeDataLayer(layerObj) {
14471447
}
14481448

14491449
function makeImageLayer(layerObj) {
1450-
let layerUrl = layerObj.url
1451-
if (!F_.isUrlAbsolute(layerUrl)) layerUrl = L_.missionPath + layerUrl
1450+
let layerUrl = L_.getUrl(layerObj.type, layerObj.url, layerObj)
1451+
if (!F_.isUrlAbsolute(layerUrl)) {
1452+
layerUrl =
1453+
`${window.location.origin}${(
1454+
window.location.pathname || ''
1455+
).replace(/\/$/g, '')}/${layerUrl}`
1456+
}
14521457

14531458
let bb = null
14541459
if (layerObj.hasOwnProperty('boundingBox')) {
@@ -1492,17 +1497,13 @@ function makeImageLayer(layerObj) {
14921497
isNaN(parseFloat(layerObj.cogMin)) ||
14931498
isNaN(parseFloat(layerObj.cogMax))
14941499
) {
1495-
let path
1496-
if (layerObj.url.startsWith('http')) path = layerObj.url
1497-
else path = 'Missions/' + L_.mission + '/' + layerObj.url
1498-
14991500
// Try to get the min and max values using gdal if the user did not input min/max in the layer config
15001501
$.ajax({
15011502
type: calls.getminmax.type,
15021503
url: calls.getminmax.url,
15031504
data: {
15041505
type: 'minmax',
1505-
path: calls.getprofile.pathprefix + path,
1506+
path: calls.getprofile.pathprefix + layerUrl,
15061507
bands: '[1]', // Assume the geotiff images only have a single band
15071508
},
15081509
async: false,

0 commit comments

Comments
 (0)