Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 6 additions & 20 deletions src/essence/Basics/Layers_/Layers_.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,24 +271,6 @@ const L_ = {
nextUrl = `/${nextUrl}`
}
}
if (layerData && layerData.throughTileServer === true) {
let bandsParam = ''
if (layerData.cogBands) {
layerData.cogBands.forEach((band) => {
if (band != null) bandsParam += `&bidx=${band}`
})
}
let resamplingParam = ''
if (layerData.cogResampling) {
resamplingParam = `&resampling=${layerData.cogResampling}`
}

nextUrl = `${window.location.origin}${(
window.location.pathname || ''
).replace(/\/$/g, '')}/titiler/cog/tiles/${
layerData.tileMatrixSet || 'WebMercatorQuad'
}/{z}/{x}/{y}.webp?url=${nextUrl}${bandsParam}${resamplingParam}`
}
return nextUrl
},
//Takes in config layer obj
Expand Down Expand Up @@ -587,8 +569,12 @@ const L_ = {
}

if (s.type === 'image') {
if (L_.layers.layer[s.name].options.pixelValuesToColorFn
&& L_.layers.layer[s.name].options.pixelValuesToColorFn !== null) {
if (
L_.layers.layer[s.name].options
.pixelValuesToColorFn &&
L_.layers.layer[s.name].options
.pixelValuesToColorFn !== null
) {
L_.layers.layer[s.name].clearCache()
L_.layers.layer[s.name].updateColors(
L_.layers.layer[s.name].options
Expand Down
12 changes: 9 additions & 3 deletions src/essence/Basics/Layers_/leaflet-tilelayer-middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ var colorFilterExtension = {
getTileUrl: function (coords) {
let url = L.TileLayer.prototype.getTileUrl.call(this, coords)

if (this.options.splitColonType === 'stac-collection') {
if (
this.options.splitColonType === 'stac-collection' ||
this.options.splitColonType === 'COG'
) {
let datetime
if (this.options.endtime != null) {
if (this.options.starttime != null) {
Expand All @@ -32,11 +35,14 @@ var colorFilterExtension = {
if (datetime != null)
url += `${
url.indexOf('?') === -1 ? '?' : '&'
}datetime=${datetime}&exitwhenfull=false&skipcovered=false`
else
}datetime=${datetime}`

if (this.options.splitColonType === 'stac-collection') {
url += `${
url.indexOf('?') === -1 ? '?' : '&'
}exitwhenfull=false&skipcovered=false`
}

if (this.options.cogMin != null && this.options.cogMax != null) {
url += `${url.indexOf('?') === -1 ? '?' : '&'}rescale=[${
this.options.currentCogMin != null
Expand Down
35 changes: 31 additions & 4 deletions src/essence/Basics/Map_/Map_.js
Original file line number Diff line number Diff line change
Expand Up @@ -1083,23 +1083,27 @@ async function makeTileLayer(layerObj) {

let splitColonType
const splitColonLayerUrl = layerObj.url.split(':')
if (splitColonLayerUrl[1] != null)
if (splitColonLayerUrl[1] != null) {
let bandsParam = ''
let b
let resamplingParam = ''

switch (splitColonLayerUrl[0]) {
case 'stac-collection':
splitColonType = splitColonLayerUrl[0]
const splitParams = splitColonLayerUrl[1].split('?')

// Bands
let bandsParam = ''
let b = layerObj.cogBands
bandsParam = ''
b = layerObj.cogBands
if (b != null) {
b.forEach((band) => {
if (band != null) bandsParam += `&bidx=${band}`
})
}

// Resampling
let resamplingParam = ''
resamplingParam = ''
if (layerObj.cogResampling) {
resamplingParam = `&resampling=${layerObj.cogResampling}`
}
Expand All @@ -1113,9 +1117,32 @@ async function makeTileLayer(layerObj) {
}/{z}/{x}/{y}?assets=asset${bandsParam}${resamplingParam}`
layerObj.tileformat = 'wmts'
break
case 'COG':
splitColonType = splitColonLayerUrl[0]
// Bands
bandsParam = ''
b = layerObj.cogBands
if (b != null) {
b.forEach((band) => {
if (band != null) bandsParam += `&bidx=${band}`
})
}

resamplingParam = ''
if (layerObj.cogResampling) {
resamplingParam = `&resampling=${layerObj.cogResampling}`
}

layerUrl = `${window.location.origin}${(
window.location.pathname || ''
).replace(/\/$/g, '')}/titiler/cog/tiles/${
layerObj.tileMatrixSet || 'WebMercatorQuad'
}/{z}/{x}/{y}.webp?url=${layerUrl}${bandsParam}${resamplingParam}`

default:
break
}
}

let bb = null
if (layerObj.hasOwnProperty('boundingBox')) {
Expand Down
8 changes: 6 additions & 2 deletions src/essence/Tools/Layers/LayersTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,16 @@ var LayersTool = {

if (
!layer.url.startsWith('stac-collection:') &&
!layer.url.startsWith('COG:') &&
layer.type !== 'image' &&
layer.type !== 'velocity'
)
return
if (
layer.cogTransform !== true &&
(layer.url.startsWith('stac-collection:') || layer.type === 'image')
(layer.url.startsWith('stac-collection:') ||
layer.url.startsWith('COG:') ||
layer.type === 'image')
)
return
if (
Expand Down Expand Up @@ -618,7 +621,8 @@ function interfaceWithMMGIS(fromInit) {
if (
node[i].cogTransform === true &&
typeof node[i].url === 'string' &&
node[i].url.split(':')[0] === 'stac-collection'
(node[i].url.split(':')[0] === 'stac-collection' ||
node[i].url.split(':')[0] === 'COG')
) {
if (window.mmgisglobal.WITH_TITILER === 'true') {
// prettier-ignore
Expand Down