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. RC-29: access to 3G data network going down after onResume()?

Anybody willing to check out a problem I found on the G1 I have?

When testing the app I am working on, I am mainly using WLAN in order
to have relatively constant up-/download characteristics (speed/
latency). No need to weight T-mobile's network down either. One
concern is the coming back to live after receiving an onResume(). I've
tested this on WLAN and it checks out fine.
Then on to test on T-Mobile's 3G network. This test coincided with an
OTA update to RC-29 this morning. I am seeing strange things now. Of
particular concern is the following: Access to the 3G data network
completely breaks down (without the network going down (;->)). This
happens with any app that accesses the Internet, including Maps or the
browser. Here's what happens on my G1: Put the phone to sleep. Let it
sit for maybe 15 or 30 minutes, then bring it back to life (e.g. push
Menu button twice) and without delay start requesting data by moving
the map around. This seems to fall into a window where the phone is
not quite ready to access the data network. It's perfectly fine to
require a couple of seconds to reconnect to the network, but once it
has, everything should be back to normal. Not on my phone. When I
perform the above test, the phone/Android completely loses access to
the data network. I can reproduce this all time, assuming the phone
has been sleeping long enough. The only remedy is to restart the
phone.  TIA.


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

2. G1 treated as disk... All the time

I downloaded the driver for the G1 and attached it to my PC so I could
resume development after my MacBook decided off was better than on.
Was test driving the phone via USB and attached it as a storage
device.

The problem now is, Windows won't stop treating the phone as a USB
drive, even when the USB option is unchecked (It treats it as having
no capacity).

Has anyone else run into this problem?  Is there a way to fix it?
--~--~---------~--~----~------------~-------~--~----~

3. Image rotation

4. android on windows OS

5. How open Android will be?

6. some audio problems

7. Layout like android's Home Screen