From b40892ec5e316a294bcd70f8f00151ff3c1eb92e Mon Sep 17 00:00:00 2001 From: dbauszus-glx Date: Wed, 1 Nov 2023 12:22:20 +0000 Subject: [PATCH] Provide format:tiles source param --- lib/layer/format/tiles.mjs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/layer/format/tiles.mjs b/lib/layer/format/tiles.mjs index d76d1cba53..b37e2110ea 100644 --- a/lib/layer/format/tiles.mjs +++ b/lib/layer/format/tiles.mjs @@ -1,11 +1,22 @@ +const sources = { + OSM: layer => new ol.source.OSM({ + url: decodeURIComponent(layer.URI), + opaque: false, + transition: 0, + }), + XYZ: layer => new ol.source.OSM({ + url: decodeURIComponent(layer.URI), + opaque: false, + transition: 0, + }) +} + export default layer => { + layer.source ??= 'OSM' + layer.L = new ol.layer.Tile({ - source: new ol.source.OSM({ - url: decodeURIComponent(layer.URI), - opaque: false, - transition: 0, - }), + source: sources[layer.source](layer), layer: layer, zIndex: layer.style?.zIndex || 0 })