I ran into this same issue trying to render many complicated polygons and polylines. I have since migrated my code to use bratliff's polycluster library. I can't recommend it enough! And the progress that has been made over the past month has made it even better.
On Mon, Feb 15, 2010 at 10:51 AM, bratliff <[email protected]> wrote: > On Feb 15, 11:48 am, Jasperdc <[email protected]> wrote: > > Hello, > > > > I'm currently trying to figure out how I can show traffic information > > in an overlay on a Google Map (in a country where google maps does not > > already support Live Traffic). The provided data looks like: "point a > > to point b is red" but the problem is that I've got approx. 2000 of > > these small lines, this causes the browser to crash/timeout due to the > > long render time (obviously) when adding them to the map one by one. > > > > Now I was wondering if encoded polygon lines are really the way to go > > here... maybe I could group by color so I would have 3 encoded poly > > line objects (e.g. green,orange,red,...). The problem in this case is > > that the highways obviously head in multiple directions, which makes > > it impossible to define in a single polyline (as far as I know). > > > > So my final question would be: > > Does anyone have experience with drawing complex polylines in multiple > > directions with up to about 2000 small parts? > > > > An alternative solution would be to draw all the roads in green by > > default and overwrite parts with red/orange where applicable. > > > > Thanks in advance, > > Jasper > > Look at the "Lake Michigan Shore" demo accessable from: > > http://www.polyarc.us > > It is a small demo but it scales well. A single OverlayView handles > all polys rather than one OverlayView per poly. A single event > listener handles all dragging, panning & zooming. Polys are defined > in a cluster rather than individually. Polys must have unique names > which are their reference handles. > > You can change the color of several polys to the same color with the > "setColor" method. > > var polyarray=[polya,polyb,polyc,polyd, ... ]; > > var > > color={fill:,fillColor:,fillAlpha:,stroke:,strokeColor:,strokeAlpha:,weight:}; > > cluster.setColor(polyarray,color); > > -- > You received this message because you are subscribed to the Google Groups > "Google Maps JavaScript API v3" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-maps-js-api-v3%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-maps-js-api-v3?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" 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-js-api-v3?hl=en.
