-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Untoggle overlays and additional base layers #772
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
Conversation
folium/map.py
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
LayerControl
class to untoggle overlays that havehidden=True
. While I was there I simplified the checks in render(). If an item is an instance ofLayer
it will always have theoverlay
andcontrol
attributes.I added the
hide
parameter to some classes to test it out, but not to all children ofLayer
yet.What do you guys think, is this a good way to do this?