Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SideBySideLayers plugin not working #1730

Closed
giswqs opened this issue Feb 18, 2023 · 7 comments
Closed

SideBySideLayers plugin not working #1730

giswqs opened this issue Feb 18, 2023 · 7 comments

Comments

@giswqs
Copy link
Contributor

giswqs commented Feb 18, 2023

Describe the bug
The SideBySideLayers plugin for folium v0.14.0 is not working properly. The slider can't be moved.

@Conengmo @fralc

To Reproduce

https://colab.research.google.com/github/python-visualization/folium/blob/main/examples/Plugins.ipynb

```bash
!pip install -U folium
import folium
from folium import plugins

m = folium.Map(location=(30, 20), zoom_start=4)

layer_right = folium.TileLayer('openstreetmap')
layer_left = folium.TileLayer('cartodbpositron')

sbs = plugins.SideBySideLayers(layer_left=layer_left, layer_right=layer_right)

layer_left.add_to(m)
layer_right.add_to(m)
sbs.add_to(m)

m

Peek 2023-02-18 14-43

It should work like this:

https://ipyleaflet.readthedocs.io/en/latest/controls/split_map_control.html
Peek 2023-02-18 14-45

@jtmiclat
Copy link
Contributor

jtmiclat commented Feb 26, 2023

Hi @giswqs I was able to fix the issue by pinning to an older version of the minified js. Can you verify if this fixes your problem as well?

import folium
from folium import plugins

class FixedSideBySideLayers(plugins.SideBySideLayers):
    default_js = [
        (
            "leaflet.sidebyside",
            "https://cdn.jsdelivr.net/gh/digidem/leaflet-side-by-side@2.0.0/leaflet-side-by-side.min.js",
        ),
    ]
   


m = folium.Map(location=(30, 20), zoom_start=4)

layer_right = folium.TileLayer('openstreetmap')
layer_left = folium.TileLayer('cartodbpositron')

sbs = FixedSideBySideLayers(layer_left=layer_left, layer_right=layer_right)

layer_left.add_to(m)
layer_right.add_to(m)
sbs.add_to(m)

m

@giswqs
Copy link
Contributor Author

giswqs commented Feb 26, 2023

@jtmiclat Yes, it works.

@jtmiclat
Copy link
Contributor

Thanks for checking it! I opened a PR #1732 to merge the fix.

@Conengmo
Copy link
Member

Since #1732 was merged we can close this issue.

@mrgeorge
Copy link

mrgeorge commented Sep 7, 2023

Thanks for posting the issue and for the fix. I ran into the same thing with v0.14.0 - any plans to cut a new release tag with this fix?

@Conengmo
Copy link
Member

Conengmo commented Sep 8, 2023

Hi Matt, valid question. I was planning to do a v1.0 release when the documentation was updated, which we merged this week, so we should get working on that release!

@mrgeorge
Copy link

mrgeorge commented Sep 8, 2023

Cool, congrats on the milestone!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants