Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
GoogleCodeExporter opened this issue Feb 7, 2016 · 2 comments

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

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

  • Changed state: Accepted
  • Added labels: Type-Enhancement

@GoogleCodeExporter
Copy link
Author

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

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant