Actually this same idea can be used with complex polyline routes with
great success:

http://www.elisanet.fi/marko_rautajoki/polyline/bin-release/PolyLineTest.html

Especially with firefox, large polylines on the map seem to cause
performance issues. You can compare the two methods in the above
example. "Draw polyline route" button uses the default Google maps
polyline overlay to draw the route. "Draw custom overlay route" uses
the methods discussed above.

I don't really know whats wrong with the default polyline of the
google maps. Flex should have no problems with vector shapes. Maybe
fromLatLngToPaneCoords is used for every point in the polyline every
time positionOverlay fires? The heavy projection calculations that the
method probably executes might explain the performance issue with
polylines that consists of many coordinate points ( above example has
over 2300 points ).

-Marko

On 21 helmi, 20:35, "[email protected]"
<[email protected]> wrote:
> Yes, you can add eventlisteners to each marker. I modified the last
> version of the app to demonstrate this:
>
> http://www.elisanet.fi/marko_rautajoki/overlaygrouping/bin-release/gm...
>
> And ofcource the markers are not limited to being just sprites. They
> can be any displayobjects ( images for example ).
>
> - Marko
>
> On 21 helmi, 19:58, "[email protected]" <[email protected]> wrote:
>
> > Hi Marko-
>
> > Looks great.  Thanks for sharing your code.  Have you tried adding
> > individual eventlisteners to each marker?  Would that be possible with
> > your design?
>
> > cheers
>
> > On Feb 22, 1:19 am, "[email protected]"
>
> > <[email protected]> wrote:
> > > Ok, just realized, that I really don't have to call
> > > fromLatLngToPaneCoords for every marker when positionOverlay fires. I
> > > changed the app so, that when map is panned ( i.e. zoom level does not
> > > change ), fromLatLngToPaneCoords is only called for one marker which
> > > determines the delta amount that all markers must be moved. If
> > > zoomlevel changes, all marker positions are recalculated with
> > > fromLatLngToPaneCoords. This changed the performance dramatically and
> > > now even firefox can handle the 1000 markers easily. The new app is
> > > here with view source enabled:
>
> > >http://www.elisanet.fi/marko_rautajoki/overlaygrouping/bin-release/gm...
>
> > > -Marko
>
> > > On 21 helmi, 09:43, "[email protected]"
>
> > > <[email protected]> wrote:
> > > > I triend grouping the markers in to a single layer. The performance is
> > > > indeed very much better than when using separate overlay for each
> > > > marker. Here is the app( i've enabled view source ):
>
> > > >http://www.elisanet.fi/marko_rautajoki/overlaygrouping/bin-release/gm...
>
> > > > For comparison here is the same app with default GMap markers:
>
> > > >http://www.elisanet.fi/marko_rautajoki/overlaygrouping/bin-release/gm...
>
> > > > I don't know if my implementation of grouping the markers is any where
> > > > near optimal, but still the performance seems to increase
> > > > significantly from using the default Markers. For some reason though,
> > > > performance with IE7 is much better than with Firefox ( Does anyone
> > > > have any idea why this is the case? ).
>
> > > > I used a separate UIComponent on top of the map as a container for my
> > > > markers. This solution seemed to have a better performance than by
> > > > using one of the maps panes. The operation that causes the most
> > > > performance issues seems to be the pane.fromLatLngToPaneCoords
> > > > ( ... ).
>
> > > > Even with overlay grouping the performance is not nearly perfect. For
> > > > example the app atthttp://madoffmap.com/performsmuchbetterand
> > > > even seems to have much more markers. Maybe they are not
> > > > using .fromLatLngToPaneCoords at madoffmap because with that many
> > > > markers that operation alone would cause problems...
>
> > > > -Marko
>
> > > > On 21 helmi, 02:41, Bryan Dunbar <[email protected]> wrote:
>
> > > > > Pamela - Thanks for the code samples. Seems still though that when 
> > > > > adding a
> > > > > lot of markers the panning slows down tremendously.
>
> > > > > For my case I'm trying to manage layers of polygons that I'm creating 
> > > > > by
> > > > > parsing an ESRI shape file and creating polygons (actually a bunch of
> > > > > encoded polylines). I currently have a map with all the countries of 
> > > > > the
> > > > > world outlined via this technique but the pan/zoom performance is not 
> > > > > good.
> > > > > So, I'm looking to create a new overlay type that is basically a 
> > > > > collection
> > > > > of polylines and can pefrom when panning/zooming.
>
> > > > > I'm going to take a shot at it. If I get anywhere with it I'll be 
> > > > > sure to
> > > > > post some code.  If anybody has some ideas please feel free to 
> > > > > email/post.
>
> > > > > Thanks,
> > > > > Bryan
>
> > > > > On Fri, Feb 20, 2009 at 5:08 PM, pamela fox <[email protected]> 
> > > > > wrote:
>
> > > > > > Hey all-
>
> > > > > > Bart, thanks for a great description of what you do for better
> > > > > > performance. I know another developer that does that with great
> > > > > > success as well (see:http://madoffmap.com/)
>
> > > > > > For those looking to emulate, there are various examples of
> > > > > > OverlayBase subclasses here:
>
> > > > > >http://code.google.com/apis/maps/documentation/flash/demogallery.html...
>
> > > > > > I do want to say that we are working on improving the performance of
> > > > > > overlays (particularly markers) in the Flash API still - likely in 
> > > > > > the
> > > > > > next version. But Bart's idea is a great one to implement, 
> > > > > > regardless.
>
> > > > > > - pamela
>
> > > > > > On Sat, Feb 21, 2009 at 8:31 AM, Bryan Dunbar 
> > > > > > <[email protected]>
> > > > > > wrote:
> > > > > > > Bart - Do you have an example of extending overlay base? i'm in 
> > > > > > > the
> > > > > > middle
> > > > > > > of implementing the idea of "layers", i.e. collection of
> > > > > > > polylines/polygons/markers. When I get a bunch of them on the 
> > > > > > > map, say
> > > > > > for
> > > > > > > example a layer of the countries of the world the performance of 
> > > > > > > panning
> > > > > > > zooming becomes terrible. I think implementing something like 
> > > > > > > your custom
> > > > > > > overlay would be the right way to go.
>
> > > > > > > Thanks,
> > > > > > > Bryan
>
> > > > > > > On Fri, Feb 20, 2009 at 1:16 PM, [email protected]
> > > > > > > <[email protected]> wrote:
>
> > > > > > >> Very interesting point Bart. This might actually solve our 
> > > > > > >> problem. I
> > > > > > >> have to try this out immediately. Thanks very much for the input!
>
> > > > > > >> - Marko
>
> > > > > > >> On 20 helmi, 17:25, Bart <[email protected]> wrote:
> > > > > > >> > Marko,
>
> > > > > > >> > A second opinion on this:
>
> > > > > > >> > On a project where i need to load 500+ markers i found the 
> > > > > > >> > performance
> > > > > > >> > of the API Markers problematic indeed, regardless of me using 
> > > > > > >> > Flash or
> > > > > > >> > Flex, and any MS/Firefox/Chrome browser i try. Disappointing 
> > > > > > >> > because i
> > > > > > >> > would expect a Flash API to be much more powerful in this then 
> > > > > > >> > it's
> > > > > > >> > JavaScript counterpart.
>
> > > > > > >> > Maybe this is because each individual marker is added as a 
> > > > > > >> > separate
> > > > > > >> > overlay instead of grouping them all into a single overlay to 
> > > > > > >> > manage.
> > > > > > >> > In my case the Javascript API is not an option and i simply 
> > > > > > >> > decided
> > > > > > >> > not to use the API markers but create my own instead.
>
> > > > > > >> > I created a class inheriting OverlayBase and load my own set 
> > > > > > >> > of Sprite
> > > > > > >> > objects with custom images, event handlers etc. all into this 
> > > > > > >> > single
> > > > > > >> > custom layer. No problem whatsoever the performance is great, 
> > > > > > >> > even
> > > > > > >> > with 500+ sprites which all get moved around when the 
> > > > > > >> > positionOverlay
> > > > > > >> > fires  (the user is dragging the map).
>
> > > > > > >> > Another benefit of creating my own custom overlay with markers 
> > > > > > >> > is that
> > > > > > >> > i am not "restricted" by how the API markers & info windows 
> > > > > > >> > work,
> > > > > > >> > instead i can define the "look and feel" of the map 
> > > > > > >> > interactions
> > > > > > >> > myself, out of the blue...
>
> > > > > > >> > Bart
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API For Flash" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-maps-api-for-flash?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to