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.
Related
Hao, stackoverflow!
I'm using Android Maps Utils to cluster markers, it's a little bit tricky, but generally ok.
Map Utils has some default value, on which zoom level it splits one cluster to several clusters or markers. I just need to do it earlier i.e. i need to start split items on bigger zoom level rather then default value.
I think it's not about shoudRenderAsCluster(cluster), cause this callback called already with splitted clusters after this default zoom level.
I've tried GridBasedAlgorithm (really strange behavior when zooming out) and NonHierarchicalDistanceBasedAlgorithm (it seems default).
Thanks!
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
Background: I want to draw several Polygons on a map (few thousand coordinates in all). This worked pretty fast on Google Maps V1 by Overlays. But Google Maps V2 seems to be ineligible for that.
First of all I tried to add polygons directly to the map by
googleMap.addPolygon(myPolygonOptions);
but this is not just unusable slow, it seems to be buggy too, because it always forgets some polygons.
Then I tried to draw the polygon on an invisible view placed above the map, by drawing paths. But the method
projection.toScreenLocation(geoCoordinate);
is a joke to its "toPixels" Google Maps V1 counterpart. Where Google Maps V1 takes 1 second, Google Maps V2 takes 21(!) seconds, so this is unusable too.
Then I thought about giving Overlays a try. Ground overlays seems to be what I'm looking for:
A ground overlay is an image that is fixed to a map. Unlike markers,
ground overlays are oriented against the Earth's surface rather than
the screen, so rotating, tilting or zooming the map will change the
orientation of the image. Ground overlays are useful when you wish to
fix a single image at one area on the map.
But then I read a comment in this posting that it is not performant too and doesn't even work well.
So the last hope are Tile Overlays. The question is: What happens with tile overlays when I rotate the map. Do they change their orientation too or will they stay oriented as loaded?
[UPDATE]
I tried GroundOverlays and they are pretty fast, even on old Smartphones, so I will choose this approach.
The tile will be rotated together with the map. The TileProvider will not get aware of the rotation at all. While drawing the tile is always oriented north up. You may have a look at the answer to this SO question for a very handy tile provider: Google Maps API v2 draw part of circle on MapFragment
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.
I have an app that use the old google map API and add a layer over the map to display a more precise map of my own over the map.
I'm trying to do this in the API v2 using the TileOverlay but the text of the google map are displayed over my tiles.
Here are 2 screenshots, one with the map, and one with the map with an overlay (just based on the API demo)
I tried to add a big Z-Index to the tiles without any results.
Is there any way to really cover the map with custom tiles ?
The reason why you keep seeing the labels, is that in google maps v2 the labels are rendered locally instead of being part of tile bitmaps. The benefit of this, is that you can rotate the map and still have the labels without rotation for easy reading.
Solution
The only solution I know so far is to disable the map base layer using setMapType(MAP_TYPE_NONE). However, this may have the undesireble effect of also disabling parts of the map that are not being covered by your overlay.
Regards.