Over the past year or two I've put together a fairly robust thematic
mapping service that is basically a Google Maps code generator
(plugandplaymaps.com). Behavior in all 4 or 5 major browsers (testing
extensively from my several windows machines and occasionally from
friends' macs) has always been pretty similar, with only minor
performance differences but never any functional differences.

Last week I added a function to support a click-to-select/unselect map
features (markers, lines, polygons) and, in the legend, display
statistics for the currently-selected features. I implemented this by
adding features in pairs, one for the "selected" state and one for the
"not selected' state, and toggling their visibility on each click
(from my reading this seems to be the common if not the only way to
change the appearance of an item in response to a click(?)).  For data
rendered as markers, this works fine in all browsers.

For polygons, this works splendidly in FF, and just fine (though a bit
slow) in IE6/7/8, but it absolutely crashes and burns in both Chrome
and Safari. In those browsers, I can select up to about 5 polygons and
then subsequent clicks render "selected" polygons as invisible (though
I can still toggle them back to "unselected" and the stats are
computed, so it's a rendering problem not a missing-overlay problem).
If I zoom in and out, sometimes some of the missing polygons do
render, sometimes not. Performance generally deteriorates rapidly, and
in both browsers there's an insane amount of disk thrashing.  It's
definitely associated with the selection pairs -- for just regular
polygon layers none of the browsers has any problems.

Here's a sample map that will exhibit the problem:
http://www.plugandplaymaps.com/test/selectiondemo.html
Look at it with FF or IE first, so you can see how it is supposed to
work. Then try it in Safari or Chrome. The problems exist on both
Windows and Mac platforms.

Obviously you can find the (generated) Javascript in a debugger, but
you can also see it by entering the Plug and Play Maps script directly
in the address bar of the browser -- the maps are generated in
response to a <script> that calls plugandplaymaps.com. Here is the
call in the page mentioned above:

http://www.plugandplaymaps.com/js/?datafile=http://www.plugandplaymaps.com/test/Census2000.csv&sym=areas&colorbar=blue&coloritem=Population&selectable=on&selstats=cnt,sum,pct,min,avg,max

There is a gallery of demos that do NOT use this new selection
function that show that the generated code is just fine in all
browsers for non-paired features:

http://www.plugandplaymaps.com/gallery/

A further word about my implementation of the selected/unselected
pairs, in case this is the cause of my grief: I create each object
first by calls to GPolygon.fromEncoded. I then make each one an
attribute of the other, like this:
fr=new GPolygon.fromEncoded(...);
fs=new GPolygon.fromEncoded(...);
fr.tgl = fs;
fs.tgl = fr;
...
map.addOverlay(fr);
map.addOverlay(fs);
The fact that it works fine in FF makes me think it's not a totally
wrong way to do it, but the fact that it fails so horribly in Chrome
and Safari make me think I must be doing some fundamental no-no.

Hope someone can shed some light, steer me towards some useful
discussions, or provide good ideas for debugging.

Many thanks,

Chris

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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?hl=en.

Reply via email to