question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Layer control and Fullscreen disappear after adding another layer

See original GitHub issue

Here is the first part of the code where I create a map with many layers

mapa_keys = folium.Map(width=1000, height=1000, zoom_start=11,
                  location=[53.132489, 23.16884], tiles='cartodbpositron')

for key in list(locations_dict.keys()):
    HeatMap(locations_dict[key], name=key, radius = 20).add_to(mapa_keys)  

folium.LayerControl().add_to(mapa_keys)
plugins.Fullscreen(
    position='topright',
    title='rozwiń na pełny ekran',
    title_cancel='wyłącz tryb pełnego ekranu',
    force_separate_button=True).add_to(mapa_keys)
mapa_keys.save("static_per_type.html")

Explanations: structure of the locations_dict is just like {"something": [[lat,lon], [lat,lon]... ] ... }

Then I decided to add a different heat map that is not included in the dictionary I’ve mentioned

others_hm = HeatMap(locs, name="others", radius=20)
kibice_hm.add_to(mapa_others)
kibice_hm.add_to(mapa_keys)
folium.LayerControl().add_to(mapa_keys)
mapa_keys.save("static_extended.html")

Problem description

The HeatMap object alone works – on a the mapa_others everything looks fine. The problem is with the bigger map. I’d like to have the heat map just as a another layer on the working map I created earlier but instead I get the layer added but LayerControl and Fullscreen button disappear so that I can’t chose the layer. The buttons are simply not showing up after adding another HeatMap layer

folium.__version__ returns '0.5.0'

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

4reactions
jakobgagercommented, Dec 12, 2019

There seems to be a problem with the ordering of the individual entities. If you take the following code snippet:

m1 = folium.Map(location=[51.4646341, 7.0022209], zoom_start=14)
f1 = folium.FeatureGroup(name='F1').add_to(m1)
# f2 = folium.FeatureGroup(name='F2').add_to(m1)  # ---> works fine (2)

folium.PolyLine([[51.4646341, 7.0022209],[51.4666341, 7.0022209]]).add_to(f1)
folium.LayerControl().add_to(m1)   # ---> when moved to the end, everything is working again

f2 = folium.FeatureGroup(name='F2').add_to(m1)   # ---> not working (1)
folium.PolyLine([[51.4646341, 7.0022209],[51.4646341, 7.0042209]], color='red').add_to(f2)

There are two cases considered here: (1) if the second feature group is added to the map after the layer control is added, there is a rendering error (2) if the second feature group is added to the map before the layer control is added, it works fine.

Is there a possibility to reorder the children of the map and force a rerendering? I tried to modify m1._children appropriately, but this had no impact on the resulting html code.

2reactions
Conengmocommented, Aug 1, 2018

I’m closing this issue since there is no update on it. Feel free to add additional info, we can reopen if needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Icon inside Leaflet control layer does not display?
1 Answer 1 · it is actually missing I checked it. I added the folder images but still the problem persists. I did...
Read more >
Fullscreen video disappears when using CSS transform on ...
1985.143 Safari/537.36 Steps to reproduce: Create a video element that opens in an overlay, then click that video element's fullscreen button. The basic...
Read more >
Control panel overlay doesn't appear in fullscreen mode for 3 ...
When a video is playing in a window, I double click on it for full screen, move my mouse, the control panel shows....
Read more >
Text that I added to video disappears in full screen mode
The text is added as expected but when I put the video in full screen mode the text disappears. This problem was present...
Read more >
Why won't the controls disappear in Windows Media Player?
Open Windows Media Player. Press F10. Go to Tools > Options. There is a checkbox named Allow autohide of playback controls : check...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found