Skip to content

Add Fast marker cluster to plugins #585

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

Conversation

JamesGardiner
Copy link
Contributor

This should close #416. Adds a faster way to add marker clusters to the output map, using a javascript based callback to construct MarkerCluster objects in the browser. Script originally proposed by @ruoyu0088. I've modified that original proposal to remove the dependency on flexx and tornado.

Users can specify their own callback string should they want to by passing it as the callback kwarg when creating a FasterMarkerCluster object.

Copy link
Member

@ocefpaf ocefpaf left a comment

Choose a reason for hiding this comment

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

@JamesGardiner can you please add an entry in the change log and a Jupyter notebook demoing the new class? (Maybe you can just add an extra example in one of our current notebooks.)

m._repr_html_()

out = m._parent.render()
print(out)
Copy link
Member

Choose a reason for hiding this comment

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

Please remove the debug prints.

})();
{% endmacro %}""")

def create_marker(self):
Copy link
Member

Choose a reason for hiding this comment

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

You probably do not need to do this as a function.

@@ -19,6 +20,7 @@

__all__ = [
'MarkerCluster',
'FastMarkerCluster',
Copy link
Member

Choose a reason for hiding this comment

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

How does this compares with our MarkerCluster besides speed? Can we replace the current one with this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's some significant differences - the main one being that the FastMarkerCluster object calls super(FastMarkerCluster, self).__init__([]) - so no children are added and full functionality isn't available (for instance, calling get_bounds() returns [[None, None], [None, None]]`. I'd recommend keeping both and caveating FastMarkerCluster as being quick to draw 000's of points but loses functionality.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the clarification!

Copy link
Member

Choose a reason for hiding this comment

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

I did not read the docstrings yet, but that information should be there.

@ocefpaf
Copy link
Member

ocefpaf commented Jan 11, 2017

@JamesGardiner I am a little bit swamped right now to review this. But this change is very welcomed!
(Just letting you know that I did not abandon your PR but I will be slow to respond here.)

@JamesGardiner
Copy link
Contributor Author

No problem @ocefpaf - I completely understand. I'm finding it difficult to get time to review the notebook failure in any case. Hopefully I can get all tests passing this weekend.

@@ -1,6 +1,7 @@
0.3.0
~~~~~

- Added `FastMarkerCluster` (James Gardiner #585 (proposed by @ruoyu0088))
Copy link
Member

Choose a reason for hiding this comment

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

👍

points far quicker than the MarkerCluster class. Be aware
that the FastMarkerCluster class does not retain a
reference to any marker data, and therefore methods such as
get_bounds() are not available when using it.
Copy link
Member

Choose a reason for hiding this comment

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

Can you expand on the difference from the "regular" MarkerCluster?

@ocefpaf
Copy link
Member

ocefpaf commented Jan 23, 2017

Ignore the Travis-CI coding standards failures as those are related to new and old notebooks. I will fix that later.

Can you just comment on the docstring so we can merge this?

Thanks for the effort and the patience!

@ocefpaf ocefpaf added this to the v0.4.0 milestone Mar 6, 2017
@ocefpaf
Copy link
Member

ocefpaf commented Jun 24, 2017

Can you just comment on the docstring so we can merge this?

@JamesGardiner what is the status on this? I am planning on issuing a new release and it would be nice to get this PR merged before that.

@JamesGardiner
Copy link
Contributor Author

@ocefpaf - I can add the docstrings in before the end of this week if that helps?

@ocefpaf
Copy link
Member

ocefpaf commented Jul 4, 2017

@ocefpaf - I can add the docstrings in before the end of this week if that helps?

That works 😄

My original plan was to issue a new release before SciPy, but that is not going to happen. (Day job is keeping me busy.)

from .float_image import FloatImage
from .fullscreen import Fullscreen
from .heat_map import HeatMap
from .image_overlay import ImageOverlay
from .marker_cluster import MarkerCluster
from .polyline_text_path import PolyLineTextPath
from .fast_marker_cluster import FastMarkerCluster

Choose a reason for hiding this comment

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

F811 redefinition of unused 'FastMarkerCluster' from line 10

@JamesGardiner
Copy link
Contributor Author

@ocefpaf I've updated the docstrings in c642388

@ocefpaf
Copy link
Member

ocefpaf commented Jul 5, 2017

@JamesGardiner awesome! Thanks!!

Just a minor comment and we are good to go.

@JamesGardiner
Copy link
Contributor Author

No problem, I've pushed a fix for the typo 👍

@ocefpaf ocefpaf merged commit 7762bf1 into python-visualization:master Jul 6, 2017
@ocefpaf
Copy link
Member

ocefpaf commented Jul 6, 2017

Awesome! Thanks!!

sanga pushed a commit to sanga/folium that referenced this pull request Oct 24, 2017
…arker-cluster

Add Fast marker cluster to plugins
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.

Add a script version of MarkerCluster to speedup creating many markers.
3 participants