Reputation: 11
I am creating an app that uses Google Maps to show locations of stores. I have an array of 5900+ locations that I would like to have on the map. I am currently using https://github.com/MadsFrandsen/MapStateListener to make markers in a location visible and hide all other markers that are not in the screen range.
However the problem is mainly how loading 5900 markers onto the map on initialization takes quite a few seconds and reduces the devices speed and I keep retrieving errors about skipped frames.
What methods do I have that will best allow me to have these locations available when a user scrolls from state to state (as I load 50KM away from initial device location) ?
Upvotes: 0
Views: 735
Reputation: 507
First, you should group your markers into one if they are too close to each other when user zooms out. Then you should update your map only if user stops scrolling, zooming. It will take you a possibility to make UI faster.
You should add so many markers on map so user can see on the screen
Upvotes: 0
Reputation: 75635
I pretty much doubt you need to display all 6k markers on your map at once as your view will get rather crowdy. However if you really think that makes sense, there's library that you may find useful -> Android Maps Extensions
demo: https://play.google.com/store/apps/details?id=pl.mg6.android.maps.extensions.demo
Upvotes: 0
Reputation: 309008
I don't think any user will find a visual filled with 5900+ markers useful.
There's no way to make this problem go faster unless you can figure out a meaningful way to display less data. You need to filter those locations better. Maybe only displaying those stores within a 10 mile radius of the current GPS location would work better. It'll render faster, and your users will thank you for not confusing them.
Upvotes: 2