Skip to content

Added options for MarkerCluster and FastMarkerCluster #837

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 8 commits into from
Jun 23, 2018

Conversation

Conengmo
Copy link
Member

I added a way to provide the marker clusters with options. It's quite straight forward. Any options will work, I specifically needed it for disableClusteringAtZoom.

The markerClusterGroup declaration in Javascript accepts an object with key/value pairs with options. I made the (Python) MarkerCluster and FastMarkerCluster to accept an options dictionary that gets json.dumped and given to the (Javascript) markerClusterGroup as argument.

Since I was there, I also included the icon_create_function argument, since it belongs in options. I didn't include any checks on validity of the options, so that's on the user.

@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-

from __future__ import (absolute_import, division, print_function)
import json

Choose a reason for hiding this comment

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

F401 'json' imported but unused

@@ -37,6 +37,9 @@ class FastMarkerCluster(MarkerCluster):
Whether the Layer will be included in LayerControls.
show: bool, default True
Whether the layer will be shown on opening (only for overlays).
options : dict, default None
A dictionary with options for Leaflet.markercluster. See

Choose a reason for hiding this comment

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

W291 trailing whitespace

icons: list of length n.
Icon for each marker.
options : dict, default None
A dictionary with options for Leaflet.markercluster. See

Choose a reason for hiding this comment

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

W291 trailing whitespace

@Conengmo
Copy link
Member Author

If there are no comments I'll merge this tomorrow.

Popup for each marker.
icons: list of length n.
Icon for each marker.
options : dict, default None
Copy link
Member

Choose a reason for hiding this comment

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

We should look into a docstring template functionality to avoid these repetitions.
I believe pandas has a nice example of that, I'll look into it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea. I don't know how to do that yet, but I'm interested to know.

@ocefpaf ocefpaf merged commit de2729f into python-visualization:master Jun 23, 2018
@ocefpaf
Copy link
Member

ocefpaf commented Jun 23, 2018

If there are no comments I'll merge this tomorrow.

Let's try to avoid self-merges. You can assign me to review whenever you want.
(I filter out most of the PRs here but I'll definitely make time if you explicitly call for my review 😉)

@Conengmo Conengmo deleted the marker-cluster-options branch June 23, 2018 11:20
@Conengmo
Copy link
Member Author

You can assign me to review whenever you want.

Alright will do! Thanks for the merge.

@ocefpaf
Copy link
Member

ocefpaf commented Jun 23, 2018

Alright will do! Thanks for the merge.

Thanks for the PR!

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.

3 participants