Drawing many map overlays efficiently

by Mark Wyszomierski » Sun, 02 Nov 2008 11:27:29 GMT

Sponsored Links

I have many pins I'd like to display on a map. I first tried adding
each as an Overlay, but this is way too slow, as each overlay tries
drawing itself even though it may not be visible within the screen

So the question is, is one overlay instance supposed to be used per
pin? Or is there some more efficient data structure to use with it?

If we are supposed to use Overlay for this, I figured I could keep the
"mercator" unit of each of my overlay cached, then recalculate the
mercator unit of the top-left, bottom-right points of the map view to
figure if an overlay should be drawn or not, which will probably be
much faster.

I'm guessing there's already some built-in way to draw a large number
of Overlays, as google is known for fast algorithms and efficiency?


Drawing many map overlays efficiently

by Mark Wyszomierski » Sun, 02 Nov 2008 14:04:48 GMT

 Ok well I am pre-calculating the 'mercator unit' for each pin now
which makes it very easy to clip pins that aren't within the bounds of
the visible map. This has helped performance a lot.

I still wonder though if Overlay adds a lot of overhead - would it be
much faster to just draw the pins myself manually?



Sponsored Links

Drawing many map overlays efficiently

by Guillaume Perrot » Sun, 02 Nov 2008 19:51:10 GMT

 An overlay can draw several items, not just one... (check
ItemizedOverlay which provides some facilities over Overlay to handle
An overlay is mandatory to "manually" draw something on the map.
An overlay is supposed to be a layer, you can draw what you want
inside, not just one pin, you can draw rects, circles, text, images
If an overlay has nothing to draw, you should remove it of the overlay
list until it has data.


Other Threads

1. ASK: cara bikin call log android unlimited (tanpa backup/export)

bagaimana ya cara agar android saya call lognya bisa unlimited?
mesti terhapus sendiri jika sudah beberapa record.

payah banget nih....   :(


2. Tutorial kedua kami untuk pengembangan aplikasi Android

Silakan dicek di:


3. Nexian Journey Cyanogen MOD 7 RC0 for Z71

4. setting internet axis di Journey

5. Help : samsung galaxy tabs tidak mau booting

6. Wow! Galaxy S Samsung Rajai Smartphone Dunia!

7. Gara2 liat iklan Aipong 4..