Animated markers on Map V2 - android

I have checked a lot of SO questions but none really answered it.
I am looking to add google map with animated markers. This means sprite display 3-4 frames while fixed at the location and while moving.
I thought about using AnimationDrawable but that didn't work. The other 2 solutions I have in mind are:
1-Use marker.setPosition and marker.setIcon in a "loopy handler". Inclined to use this but for some reason I feel it is an over kill especially that I may have 100 Markers
2-Add SurfaceView on the map and draw bitmaps using LocationToPixels functionality of the map. But that may be cumbersoms when gestures are moving.
Do you recommend any of the above or even a new solution? Please justify why so it is not an oppinionated answer.
Thank you

Related

Reducing Android Map shape overlapping draws

Forgive me if this is a duplicate, but the questions I find don't have an answer (I hope to simplify those questions).
Given two circles on a GoogleMap, how do I tell if they overlap and "smash" them into one image?
I have a lot of data points (~14K) and that many circles are not rendering well. Can they also be drawn just once, instead of 14k draw calls?
There is Google Maps API Clustering Utility. That should handle clustering your items for you.
And there is a SOF Question addressing the same issue and solutions as well.

android google map ~10k markers

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.

Android: Numerous overlays slowing down map movement

I have numerous Overlays added to a MapView. When I move, zoom in, or zoom out of the MapView the overlays cause a significant lag before the map responds to the action. Is there any way I can minimize this delay?
I saw that someone else suggested combining all the overlays into one large overlay for a similar problem. If something like that would work, how would I combine my array of overlays into a single overlay?
I also saw that it may improve performance to draw all the lines specified in the overlays on a bitmap and then overlay the bitmap instead. If this is the best option, then how would I go about implementing it?
Any help would be greatly appreciated. If you need any more information or code, then please ask!
I have numerous Overlays added to a MapView. When I move, zoom in, or zoom out of the MapView the overlays cause a significant lag before the map responds to the action. Is there any way I can minimize this delay?
Have fewer and less-complicated overlays. Use Traceview to determine exactly where your problem is. If it is that one of your existing draw() methods is slow, you will need to fix that before worrying about combining overlays. If the excess time seems to be in overlay management in MapView, then consolidating your overlays into fewer overlays may have benefit.
how would I combine my array of overlays into a single overlay?
Refactor the code into a single overlay class. Beyond that, we cannot help you, since we do not know much of anything about your overlays, other than that they are "numerous".
If this is the best option, then how would I go about implementing it?
Create a bitmap-backed Canvas, draw your lines on it, then draw the resulting Bitmap in your overlay in draw(), I presume.

Android MapView path.draw draws crazy polygon lines all over the place

I've been struggling for a couple of weeks now with google's android mapview.
I'm drawing a large amount of polygons with a large amount of points. on average 15 polygons and around 1000 points each.
The first issue I experienced was performance... No surprise. After doing some testing I realised the culprit is projection.ToPixel() which I successfully bypass when the users pans by simply moving all my points in the direction by x amount of pixels (the difference), however when zooming I have no choice but to make use of the toPixel method.
Is there possibly a more efficient way of modifying my points depending on the zoom level? after some research I've found examples on how to do this with circles and other shapes, but I have no clue where to begin with reshaping polygons, any ideas on this?
The second issue i'm having is that when I have the entire polygon in view all is grand, but when I pan over the map bounds (where the map is effectively starting again to the left and right) on any side the polygon lines seem to reach and stretch out across the map bounds causing crazy spaghetti lines all over the place! I take it what's happening is that the path.close() or path.LineTo() methods think the shortest path is flying halfway across the world to reach the next point which causes these lines. I have no idea how to address this. I simply can't ignore points that do not fall within the current lon/lat spans because that (obviously) causes the polygon to change shape al the time!
Has anyone experienced this issue and how can one go about solving it? I'm not even sure what I should be googling!?
UPDATE 1:
The problem can be easily solved by preventing the mapview from looping. Is there some way to prevent the mapview from looping the world!?!?

workaround for mapview overlays not pinch-zooming correctly

If a user does a "pinch zoom" on the map, my overlays don't properly size until the end. This has been noted in other posts, so i assume it is a known issue.
Problem is, my client finds it totally unacceptable, as I am tasked with making the android app look as good as the iphone version.
Is there any way to correct this, even if it is a horrible hack? For instance, can I subclass the mapview and handle drawing or override some other method?
The common solution is to not draw overlay during zoom animation.
UPDATED:
Sorry, I've confused zoom and move.
The problem with zoom is that you can't rely on zoom level. Instead you need to draw your overlay based on MapView.getProjection().

Categories

Resources