Skip to content

Commit

Permalink
optional source and projection param for tile layer.
Browse files Browse the repository at this point in the history
  • Loading branch information
dbauszus-glx committed Nov 2, 2023
1 parent b40892e commit 3ac8f06
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions lib/layer/format/tiles.mjs
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
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.projection ??= 'EPSG:3857'

layer.L = new ol.layer.Tile({
source: sources[layer.source](layer),
source: new ol.source[layer.source]({
projection: layer.projection,
url: decodeURIComponent(layer.URI),
transition: 0
}),
layer: layer,
zIndex: layer.style?.zIndex || 0
})
Expand Down

0 comments on commit 3ac8f06

Please sign in to comment.