I've desperately searched for the right solution that could handle up to 50 000 markers ( and why not even more if server can handle it ) while being easy on my server and I've been doing this for days.
Concept is something like this:
- What would be the best solution / language for clustering server side? Im not looking for a huge working code but I need to be pushed to right direction.
- How to "cache" or "mark" already loaded clusters / markers so that you wouldn't reload markers / clusters that has already been loaded when map is beeing zoomed in/out or panned?
Theory:
Right way to go seems similar to this:
- If map is zoomed out and there are a lot of markers, handle clustering in server
- If map is zoomed in to a point that all markers don't fit to viewport anymore, cluster only markers that are in viewport - also server
- If zoom gets so big that number of markers in viewport gets small (< 500 for example), cluster in browser via JS
Data I could use in server side and which I could also send to browser via JSON:
- Map bounds sent via ajax to server when request is made
- Total count of markers from database query
- Coordinates of markers from database query
- Probably something else important / useful that Im currently not realizing
