digidem / leaflet-side-by-side

A Leaflet control to add a split screen to compare two map overlays
http://lab.digital-democracy.org/leaflet-side-by-side/
MIT License
351 stars 111 forks source link

Can somebody update this? #52

Closed sefo closed 1 year ago

sefo commented 1 year ago

Live example doesn't work. Example code when fixed still doesn't work. (stamen layers are 404, js imports badly configured)) Importing the lib to my vueJS app displays 1 layer with the slider in the middle. No additional layer added by L.control.sideBySide(x, y)

Can someone take over and fix this? I couldn't find any alternative. Some forks out there are not working either.

sefo commented 1 year ago

It works by replacing missing tiles with correct ones. So replace the stamen layer block with:

        const otherLayer = L.tileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', {
          attribution: 'qwerty'
        }).addTo(map);
        L.control.sideBySide(osmLayer, otherLayer).addTo(map);