Untoggle overlays and additional base layers#772
Untoggle overlays and additional base layers#772ocefpaf merged 10 commits intopython-visualization:masterfrom
Conversation
| self._parent._children.items() if isinstance(val, Layer) | ||
| and val.overlay and val.control]) | ||
| self.overlays_hidden = [val.get_name() for val in | ||
| self._parent._children.values() if isinstance(val, Layer) |
There was a problem hiding this comment.
E128 continuation line under-indented for visual indent
folium/map.py
Outdated
| and val.overlay and val.control]) | ||
| self.overlays_hidden = [val.get_name() for val in | ||
| self._parent._children.values() if isinstance(val, Layer) | ||
| and val.overlay and val.control and val.hide] |
There was a problem hiding this comment.
E128 continuation line under-indented for visual indent
Yep. That fits Can you:
|
`show` toggles whether the layer is shown on opening. It is True by default. Also did some small refactoring here and there to make __init__'s and docstrings more consistent.
Doesn't really make sense to inherit from TileLayer. So I made it a bit more consistent by inheriting directly from Layer.
|
I added the I noticed I also did some work on the use of I didn't test all code I touched. I did test creating some maps with Let me know if there's something you want different or added. |
|
I noticed that according to Leaflet, any additional base layers should not be added to the map. In Folium all base layers are added to the map. As a result the last base layer is selected in layer control, while the first base layer is displayed. Fixing this by not adding additional base layers to the map is hard, since we then need to check this in every class that inherits from |
|
Perfect! Thanks @Conengmo!! |
|
thanks master! @Conengmo |
I worked on solving issue #606 and #571. I added functionality in the
LayerControlclass to untoggle overlays that havehidden=True. While I was there I simplified the checks in render(). If an item is an instance ofLayerit will always have theoverlayandcontrolattributes.I added the
hideparameter to some classes to test it out, but not to all children ofLayeryet.What do you guys think, is this a good way to do this?