I would like to show a large number of markers (50k+) on a Google Map. As it turns out, the Android Maps Util Library https://github.com/googlemaps/android-maps-utils seems to be the number one choice when clustering markers.
I was wondering if there exist any best practices in order to increase the performance of the map user experience while showing such a vast amount of markers.
Example
As an example, I used the Cluster Manager to add approx 20.000 Markers to the Cluster Manager, resulting in a not very smooth map interaction experience when zooming and panning the map.
What I used:
GridBasedAlgorithm<MyClusterItem> gridAlgorithm = new GridBasedAlgorithm<MyClusterItem>(); mClusterManager.setAlgorithm(new PreCachingAlgorithmDecorator<MyClusterItem>(gridAlgorithm));
My strategies:
1) Remove all markers from the cluster on a camera change event, then add only those within the view bounds. Works great on high zoom level, when the zoom level lowers, there are many markers to remove and to add, adding overhead to the whole clustering process
2) Adding all Markers in the first place.
As it turns out, the Android Maps Util Library https://github.com/googlemaps/android-maps-utils seems to be the number one choice when clustering markers.
2048 characters in URL is just under 100 GeoCode values. So, again no more than 100 markers.
To navigate, press the arrow keys. The number on a cluster indicates how many markers it contains. Notice that as you zoom into any of the cluster locations, the number on the cluster decreases, and you begin to see the individual markers on the map. Zooming out of the map consolidates the markers into clusters again.
How I did that in the past: You should listen map movement and draw only markers which should be visible at the moment. Also you should manage zoom level and aggregate few markers to single one if they are placed on the same screen place.
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