i am doing an android app, that is displaying markers on google map. The problem here is i need to handle ~10k markers. I can't do clustering as every marker is important and i can't show this markers from some zoom level as it is important to get the 'bigger picture'
WHAT I'VE TRIED:
displaying only visible markers, but they are too dense and still I am left with few thousands and map just can't handle it..
I moved away from google markers and created surfaceview over map fragment. And this works fine when I update my 'markers' after google map camera changes (after u stop dragging it), but this looks bad, because in between updates they are anchored to its position on screen not on map. And when i try to update my surfaceview while dragging it is not doing too well and freezes.
QUESTIONS:
will moving from surfaceview to opengl improve rendering time?
any other ideas?
EDIT:
firstly i will clarify, important is not every single marker, but the shape of the cloud of markers.
And also I've already tried heatmaps from google maps extension, but it kept freezing while dragging the map, heap kept growing until it finally breaks.
Rendering markers in google map is very resource expensive task. If the marker is custom designed it will take more time to just to create the bitmap.Traditional way of creating marker will not help here, bcz rendering is done by Main Thread. You have to implement some parallel processing to create the markers, So redering markers will not disturb your main thread. You can implement something like this
http://leaks.wanari.com/2016/05/05/rendering-markers-for-android/
I hope it will help you. Good Luck.
Related
I have 30 000 Markers inside my map and i tried Cluestering them like Google,up to here all good.
The problem is when i zoom a specific area the markers unclustered not only inside that area but in all the maps and when i unzoom all markers render on my map slowing down
i also have the same problem, showing 32k markers. they said to decide a zoom value where clustering is disabled in the Renderer shouldRenderCluster something overridden method. but i still think the clustering has limitations. i dont mind if max zoom doesnt decluster the markers. the important thing is that when they get clustered, it shouldnt happen like what you showed above.
Currently i'm adding markers by using semaphore and sleeping thread but I need to show their info windows as well after some zoom level by changing markers with icon generator . But it is still stucking UI when markers are drawing . Can anybody help me and tell me how to draw thousands of markers and handle them without using cluster manager.
add markers that inside the screen is enough to show, update markers on camera move,
I am building an application which uses Google Maps. When displaying the map, I'm also adding markers. Is there a way to see if there are 2 markers that touch each other, meaning if a part of a marker is on top of another marker? My goal is to be able to find that out and then make them a single bigger marker instead of 2 different markers.
The answer should depend somehow on the marker's icon size and the current map zoom since if I zoom out, there's a bigger chance they might overlap.
There seem to be a library made by Google which clusters a set of markers together automatically when they are close to one another.
The library is the marker clustering utility and instruction can be found here:
https://developers.google.com/maps/documentation/android-api/utility/marker-clustering
Some of the markers in google maps appear when zoomed in. However, when a user drag the map into a different place, the marker disappears, and when you drag it again on the previous place, the marker starts to animate in front of you (I hope you are getting what I'm trying to say). I want to know if there is such a way to do that. Thanks.
The same thing happens in Google Maps Android API v2 on street names, parks, etc.
There is no support for marker transparency as of this writing. You will have to code it yourself: posting to Handler until the animation finishes and setting new icon every "frame" with increasing opacity.
I have faced some problems with the Android MapView API. I get OverlayItems from a database which I want to display in a MapView. If I'm displaying 100 Icons, I have no issues, but if it gets more - like 500 Items in one City - it first looks really bad, while second it slows down a lot. Unfortunately my goal is to display 10000 of them. I think one solution can be to register a listener to ZoomLevels to make them appear/dissapear, but I couldn't find that functionality. Second, I couldn't find a function to scale my Overlays with the Zoom of the Map.
Any Ideas are very welcome
There is a very strange behavior in ItemizedOverlay draw method. When you say: Draw line from (x,y) to (x1,y1) the draw method is called about 20-30-40 times - i don't know why. It is acceptable when you draw one line, but when you draw a thousands of lines,icons and so on...it is very very bad! To solve this problem you should create a cached overlay. This is overlay that catches the first draw, creates the object and then prevents the future draws that do the same draw.
A cluster is a dozen of icons behind one icon. For example if you have 1000 markers on the map, in a specific minimal zoom level you can not see each marker separately - it becomes a mess of icons and colors and so on. And instead of 100 markers that are very very close one by one you place a cluster marker. And on zoom in remove this cluster and create another clusters...do this until the markers became far enough away and you can seen them divided.
Check this: Cluster markers
Take the following approaches:
Create a cached overlay to prevent multiple drawing of same clusters;
Draw in thread;
Cluster your markers depending on zoom level and marker proximity.
Each time you draw in the overlay, check for sure is the current marker inside of the visible part of the screen. If it is not, do no draw it!
I had a similar problem with the icon size and zoom level in my application. What I ended up doing was having 2 sets of overlays containing the markers, one with a "zoomed in" icon and one with a "zoomed out" icon. Then just changed the overlay at a certain zoom level (using a zoom poller - On zoom event for google maps on android)