syagbasan / android-maps-extensions

Automatically exported from code.google.com/p/android-maps-extensions
0 stars 1 forks source link

Map becomes laggy and unresponsive with lots of markers(especially in nearer zoomlevels) #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem? Please provide sscce (short, self
contained, correct example) when possible.

Take the DemoActivity and replace addMarkersInPoland and addMarkersInWorld with 
a method that adds about 15000-20000 different points to the map.

What is the expected output? What do you see instead?

The map should be not laggy and responsive when using Clustering.
Especially in nearer zoom levels it becomes very laggy, because the size of 
clusters decreases. Maybe it should only care about the visible markers in 
order to keep a good performance. The offscreen markers could be removed and 
added on demand. This is more a feature request than a bug report, but for my 
purpose, as a clustering solution, the library is only usefull if it can also 
handle a really big amount of markers.

Original issue reported on code.google.com by Sabian...@gmail.com on 20 Mar 2013 at 5:08

GoogleCodeExporter commented 8 years ago
Confirmed with the following code:

Random r = new Random();
BitmapDescriptor magentaIcon = 
BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA);
for (int i = 0; i < 20000; i++) {
    LatLng position = new LatLng(r.nextDouble() * 170 - 95, r.nextDouble() * 360 - 180);
    map.addMarker(new MarkerOptions().position(position).icon(magentaIcon));
}

Changes in API to be made:
ClusteringSettings.addMarkersOnlyInVisibleRegion(boolean)

Considerations:
1) Should default value of addMarkersOnlyInVisibleRegion be true?
2) Region to be used needs to be a bit bigger than what 
Projection.getVisibleRegion() returns as it should include markers that are 
outside of the screen in cluster that is partially visible.

Original comment by maciek.g...@gmail.com on 22 Mar 2013 at 12:27

GoogleCodeExporter commented 8 years ago
ClusteringSettings.addMarkersDynamically has been added. It has effect both 
when clustering is enabled and disabled.

Default value stays false to have the same behaviour as in Google Maps Android 
API v2.

Thank you for reporting this issue.

Original comment by maciek.g...@gmail.com on 24 Mar 2013 at 6:51