title: Best practices when clustering large amount of markers in Google Maps Android V2
body: <p>I would like to show a large number of markers (50k+) on a Google Map. As it turns out, the Android Maps Util Library <a href="https://github.com/googlemaps/android-maps-utils" rel="nofollow noreferrer">https://github.com/googlemaps/android-maps-utils</a> seems to be the number one choice when clustering markers. </p>
  
  <p><em>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.</em> </p>
  
  <p><strong>Example</strong></p>
  
  <p>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.</p>
  
  <p>What I used:</p>
  
  <pre><code>GridBasedAlgorithm&lt;MyClusterItem&gt; gridAlgorithm = new GridBasedAlgorithm&lt;MyClusterItem&gt;();     
  mClusterManager.setAlgorithm(new PreCachingAlgorithmDecorator&lt;MyClusterItem&gt;(gridAlgorithm));
  </code></pre>
  
  <p><strong>My strategies</strong>:<br><br>
  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</p>
  
  <p>2) Adding all Markers in the first place.</p>
  
  <ul>
  <li>100 Markers => Works great</li>
  <li>1000 Markers => Works, but already showing slowness in the process of clustering when zoom out occurs</li>
  <li>10000 Markers => Already very slow behavior, taking a long time to re-cluster the markers and the zooming in-out is not smooth</li>
  <li>20000 Markers => Re clustering takes a very long time (> 20s), the map is not responsive</li>
  </ul>