Skip to content
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

Provide function to generate icon #1086

Open
2 of 3 tasks
IanMayo opened this issue Jan 31, 2023 · 2 comments
Open
2 of 3 tasks

Provide function to generate icon #1086

IanMayo opened this issue Jan 31, 2023 · 2 comments

Comments

@IanMayo
Copy link

IanMayo commented Jan 31, 2023

  • I'm reporting a bug, not asking for help
  • I'm sure this is a Leaflet.MarkerCluster code issue, not an issue with my own code nor with the framework I'm using (Cordova, Ionic, Angular, React…)
  • I've searched through the issues to make sure it's not yet reported

I'm plotting a map with lots of markers. For most of the time, the markers will be shown as clusters - so very few markers will actually be shown.

I think this offers a performance opportunity. If MarkerCluster took a function to generate the icon markers, then it would just call that function when a parent cluster got expanded. If clusters don't get expanded then the icon marker doesn't actually get created, which optimises performance and memory.

Note: the MarkerCluster would still need to know the coords of each icon, so I guess the developer would provide a coord/function pair for each icon.

@IvanSanchez
Copy link
Member

@IanMayo
Copy link
Author

IanMayo commented Feb 1, 2023

Hello Ivan, thanks for the prompt response :-)

You mean like https://github.com/Leaflet/Leaflet.markercluster#customising-the-clustered-markers ?

It's actually that code snippet that prompted the idea.

But, the function in the snippet provides the cluster icons (shaded circle with a number in the middle), not the icons themselves. So, we'll almost always have the cluster icons, it's the individual markers themselves that I'm hoping to defer.

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

No branches or pull requests

2 participants