folium icon indicating copy to clipboard operation
folium copied to clipboard

SideBySideLayers not displaying the layers

Open brunoparente93 opened this issue 1 year ago • 1 comments

Describe the bug I am trying to use the folium plugin SideBySideLayers together with streamlit. In my app, I created 2 columns, so the users can select the layers they want to compare using the folium SideBySideLayers plugin.

The plugin works when I write the layer name, but it does not work when I add the argument layer in a variable or sometimes, it works only one side.

PS: the same happens with DualMap

To Reproduce

def layer_comparison(right, left):   #string variables
    url = "some url"
   


    m3 = folium.Map(location=[52.37361, 9.73783], zoom_start=11,tiles='cartodb positron')
            
    layer_right = folium.raster_layers.WmsTileLayer(
            url=url,
            name="Max Überflutunghohe (ohne Kanal 100a)",
            fmt="image/png",
            transparent=True,
            layers=right,
            overlay=True,
        )
            
    layer_left = folium.raster_layers.WmsTileLayer(
            url=url,
            name="Max Überflutunghohe (ohne Kanal 30a)",
            fmt="image/png",
            transparent=True,
            layers=left,
            overlay=True,
       )

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

    layer_left.add_to(m3)
    layer_right.add_to(m3)
    sbs.add_to(m3)
    return m3

layer_comparison('mk100','ok50')

Can someone help me to fix this issue?

Thank you in advance!

brunoparente93 avatar Dec 11 '23 12:12 brunoparente93

I can't reproduce your issue. Using WmsTileLayer with SideBySideLayers works for me as expected. Can you provide a fully standalone working example? I don't know what url you are using.

Is WmsTileLayer working when you add it to the map without SideBySideLayers?

Conengmo avatar Dec 24 '23 15:12 Conengmo

I'll close this issue since it's stale and missing information. If new information comes up, we can reopen it.

Conengmo avatar Sep 10 '24 08:09 Conengmo