Skip to content

Create and test FeatureGroup #242

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

Merged
merged 1 commit into from
Nov 12, 2015

Conversation

BibMartin
Copy link
Contributor

Include several object in a layer, and then control it into the layer control.

import folium
from folium.map import *
map = folium.Map()
feature_group = FeatureGroup(name='My feature group')
feature_group.add_children(Marker([45,-30],popup=Popup('-30')))
feature_group.add_children(Marker([45, 30],popup=Popup('30')))
map.add_children(feature_group)
map.add_children(folium.map.LayerControl())
map

capture du 2015-11-12 12 08 43

@ocefpaf ocefpaf self-assigned this Nov 12, 2015
@ocefpaf
Copy link
Member

ocefpaf commented Nov 12, 2015

Sweet!

@ocefpaf ocefpaf added the enhancement Feature request or idea about how to make folium better label Nov 12, 2015
@ocefpaf ocefpaf added this to the v0.2.0 milestone Nov 12, 2015
@ocefpaf
Copy link
Member

ocefpaf commented Nov 12, 2015

I am good with that PR and I will be merging it soon unless someone else raise something. (I have only 1 stupid pep8 comment.)

BTW: This PR is a perfect example of how the refactoring work you did was worth the effort.
This implementation is concise and efficient thanks to that refactoring.

@BibMartin
Copy link
Contributor Author

Thanks @ocefpaf. Please tell me your PEP8 comment ; I can change it quite quickly.

@@ -217,6 +217,34 @@ def __init__(self, tiles='OpenStreetMap', name=None,
{% endmacro %}
""")

class FeatureGroup(TileLayer):
def __init__(self, name=None, overlay = True):
"""Create a FeatureGroup layer ; you can put things in it and handle them as a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess my comment did not make it in the first try! I have a flaky connection today 😒

Please change overlay = True to overlay=True

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed and rebased

ocefpaf added a commit that referenced this pull request Nov 12, 2015
@ocefpaf ocefpaf merged commit 89cf9d3 into python-visualization:master Nov 12, 2015
@ocefpaf
Copy link
Member

ocefpaf commented Nov 12, 2015

Another great addition 🎉
Thanks @BibMartin

@BibMartin BibMartin mentioned this pull request Dec 5, 2015
@BibMartin BibMartin deleted the feature_group branch December 7, 2015 11:02
@jboynyc
Copy link

jboynyc commented Dec 8, 2015

Yes, this looks great! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request or idea about how to make folium better
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants