Skip to content

Commit

Permalink
Added allmaps layer support
Browse files Browse the repository at this point in the history
  • Loading branch information
rsnyder committed Nov 4, 2022
1 parent 37a300e commit cdf9124
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions components/Map.vue
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,8 @@ module.exports = {
syncTileLayers() {
const mapDefs = {}
this.layers
.filter(layerDef => layerDef.mapwarper || layerDef.heatmap)
.forEach(layerDef => mapDefs[layerDef['mapwarper-id'] || 'heatmap'] = layerDef)
.filter(layerDef => layerDef.mapwarper || layerDef.allmaps || layerDef.heatmap)
.forEach(layerDef => mapDefs[layerDef['mapwarper-id'] || layerDef['allmaps-id'] || 'heatmap'] = layerDef)
const next = []
if (this.tileLayers.length > 0 && this.tileLayers[0].id === this.basemap) {
Expand All @@ -321,6 +321,13 @@ module.exports = {
if (!exists) {
if (layerId === 'heatmap') {
this.addHeatmap(layerDef)
} else if (layerId === 'allmaps') {
const layer = L.tileLayer(`https://allmaps.xyz/maps/${layerDef['allmaps-id']}/{z}/{x}/{y}.png`, { maxZoom: 19, attribution: 'Allmaps' })
next.push({id: layerId, label: layerDef.label || layerDef.title, layer})
layer.options.id = layerDef.id
layer.options.label = layerDef.label || layerDef.title
layer.options.type = 'allmaps'
if (layerDef.active) layer.addTo(this.map)
} else {
const layer = L.tileLayer(`https://mapwarper.net/maps/tile/${layerDef['mapwarper-id']}/{z}/{x}/{y}.png`)
next.push({id: layerId, label: layerDef.label || layerDef.title, layer})
Expand Down

0 comments on commit cdf9124

Please sign in to comment.