developer
developer

Reputation: 11

GoogleMaps lag at a large number of markers

I apologize in advance for my English.

I have in the application of more than 5000 coordinates.

These coordinates point to the objects in all the earth.

The fact that I add all at once to the map coordinates (marker), and the map is very lag because of this! 5-6 FPS when scrolling the map.

How do I add markers for the current location (the camera), and if I scroll the map, these markers to remove, and add new to the new location (the camera).

I know there is a function idleAtCameraPosition, but how to get a list of coordinates of the array (MutableArray), which is included in the camera? How to keep track of it? I do not understand this. Can someone already did one of you is in your project?

I hope you understand that I want to convey to you.

Upvotes: 1

Views: 1440

Answers (1)

adjuremods
adjuremods

Reputation: 2998

You might want to check Marker Clustering:

By clustering your markers, you can put a large number of markers on a map without making the map hard to read. The marker clustering utility helps you manage multiple markers at different zoom levels.

When a user views the map at a high zoom level, the individual markers show on the map. When the user zooms out, the markers gather together into clusters, to make viewing the map easier.

To have some insights about loading too many marker, try reading the article about Too Many Markers!

Some applications are required to display a large number of locations or markers. Naively plotting thousands of markers on a map can quickly lead to a degraded user experience. Too many markers on the map cause both visual overload and sluggish interaction with the map. To overcome this poor performance, the information displayed on the map needs to be simplified.

Hope this helps!

Upvotes: 2

Related Questions