Drawing many map overlays efficiently

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


Sponsored Links
 Hi,

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
view.

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?

Thanks
--~--~---------~--~----~------------~-------~--~----~



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?

Thanks



--~--~---------~--~----~------------~-------~--~----~


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
items).
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
etc...
If an overlay has nothing to draw, you should remove it of the overlay
list until it has data.




--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Input Method Framework: How to use?

Hi,

I need to learn how to use the IMF to design a soft keyboard. Please
point me to some resources that will help me understand how to do it
from the ground up. Something other than the SDK sample

Cheers,
Earlence

-- 

2. Changing the name of a project/package

I changed the name of a project with a package of the same name.
However, the Resource Manager is still building R.java in gen/com/
oldname instead of gen/com/newname. I can't find the setting in
Eclipse that tells the Resource Manager where to store the R.java
file. I also notice that the package name in R.java is still oldname.
So I guess I need to tell Eclipse what the correct package name is for
R.java too. Any ideas?

-- 

3. Bluetooth Conenction Problem

4. Setup Multiple Alarms

5. Browser Source code

6. Popping up Toast (or something like it) from a thread

7. How to prevent auto whitespace trimming in TextView?