Skip to content

Add support for leaflet div markers to folium #166

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 2 commits into from
Aug 5, 2015
Merged

Add support for leaflet div markers to folium #166

merged 2 commits into from
Aug 5, 2015

Conversation

shankari
Copy link
Contributor

@shankari shankari commented Aug 5, 2015

This allows us to generate polylines that display intermediate points with popups. Updated the tests as well. Tests pass.

    bash-3.2$ PYTHONPATH=./tests ipython
    Python 2.7.10 |Anaconda 2.0.1 (x86_64)| (default, May 28 2015, 17:04:42)
    Type "copyright", "credits" or "license" for more information.

    IPython 2.1.0 -- An enhanced Interactive Python.
    Anaconda is brought to you by Continuum Analytics.
    Please check out: http://continuum.io/thanks and https://binstar.org
    ?         -> Introduction and overview of IPython's features.
    %quickref -> Quick reference.
    help      -> Python's own help system.
    object?   -> Details about 'object', use 'object??' for extra details.

    In [1]: import folium_tests

    In [2]: tester = folium_tests.testFolium()

    In [3]: tester.setup()

    In [4]: tester.test_div_markers()

This allows us to generate polylines that display intermediate points with
popups. Updated the tests as well. Tests pass.

    bash-3.2$ PYTHONPATH=./tests ipython
    Python 2.7.10 |Anaconda 2.0.1 (x86_64)| (default, May 28 2015, 17:04:42)
    Type "copyright", "credits" or "license" for more information.

    IPython 2.1.0 -- An enhanced Interactive Python.
    Anaconda is brought to you by Continuum Analytics.
    Please check out: http://continuum.io/thanks and https://binstar.org
    ?         -> Introduction and overview of IPython's features.
    %quickref -> Quick reference.
    help      -> Python's own help system.
    object?   -> Details about 'object', use 'object??' for extra details.

    In [1]: import folium_tests

    In [2]: tester = folium_tests.testFolium()

    In [3]: tester.setup()

    In [4]: tester.test_div_markers()
Add support for leaflet div markers to folium
@BibMartin
Copy link
Contributor

Thanks @shankari, that looks great! Do you think it's possible to implement it as a plugin (see plugins branch), to avoid complexifying fol_template.html ?

@ocefpaf
Copy link
Member

ocefpaf commented Aug 5, 2015

👍 to the new feature. We have to put the new folium logic out there to avoid asking people to re-do things!! (Sorry @shankari!)

@ocefpaf ocefpaf mentioned this pull request Aug 5, 2015
@shankari
Copy link
Contributor Author

shankari commented Aug 5, 2015

@BibMartin, it is possible, but it might take a while. My current patch meets my needs for visualization, and the visualization is not a core part of what I'm working on - I'm using it to debug something else. I was happy to take the little extra time to clean up my code and contribute back, but I am not sure that I have the time to work on this any further right now.

@ocefpaf, yes, new logic out there would be great. I think that people who are not actively working on folium are going to work off your existing logic/structure (I know that I did).

@BibMartin
Copy link
Contributor

@shankari No problem ; I'll go for it. You've already done a great part of the job.

@ocefpaf Shall we merge this PR as is, or create another one that would meet the new machinery ?

@ocefpaf
Copy link
Member

ocefpaf commented Aug 5, 2015

The PR came with its own test! How can I say no to that 😸? Merge away @BibMartin.

@ocefpaf
Copy link
Member

ocefpaf commented Aug 5, 2015

Thanks for the contribution @shankari!

BibMartin added a commit that referenced this pull request Aug 5, 2015
Add support for leaflet div markers to folium
@BibMartin BibMartin merged commit ab5f476 into python-visualization:master Aug 5, 2015
@themiurgo
Copy link
Contributor

I am against this PR as it is, but it can be changed to avoid code duplication / API complications.

Our #1 rule must be to avoid duplication and to follow closely what Leaflet is doing. So, instead of having yet another object (div icon), we should incorporate this into markers. This is what Leaflet does with divicons, it doesn't use a separate method / code, it just levearges marker.

http://jsfiddle.net/erictheise/k6ckm/

@ocefpaf
Copy link
Member

ocefpaf commented Aug 5, 2015

@themiurgo that is an important point. But the 🚢 has ⛵

@themiurgo
Copy link
Contributor

Sorry, it wasn't when I started to write the message.

Well it was a quick 🚢, it only took 8 hours 😜

@BibMartin BibMartin mentioned this pull request Jan 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants