Thanks to this answer I managed to come up with a temporary solution to my problem.
However, with a list of 6000 points that grows everyday it's becoming slower and slower.
I can't use a third party service* therefore I need to come up with my own solution.
Here are my requirements:
Clustering of the coordinates need to work with any zoom level of the map.
All clusters need to be cached
Ideally there won't be a need to cluster (calculate distances) on all points if a new point is added.
So far I have implemented quadtree that returns the four boundaries of my map and returns whatever coordinates are within the viewable section of the map.
What I need and I know this isn't easy is to have clusters of the points returned from the DB (postgres).
I am currently doing dynamic server-side clustering of about 2,000 markers, but it runs pretty quick up to 20,000. You can see discussion of my algorithm here:
Map Clustering Algorithm
Whenever the user moves the map I send a request with the zoom level and the boundaries of the view to the server, which clusters the viewable markers and sends it back to the client.
I don't cache the clusters because the markers can be dynamically filtered and searched - but if they were pre-clustered it would be super fast!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With