Marker clustering with KML

1,540 views
Skip to first unread message

Patrick Cain

unread,
Oct 22, 2010, 1:52:44 PM10/22/10
to Google Maps JavaScript API v3
Hello, all -

Sorry if this has been discussed before, but I can't seem to see the
post.

I have a 3,200-point .kmz file which I'd like to use some kind of
marker clustering strategy with (for graphic design reasons - it loads
pretty well.)

I've been trying to work with Svennerberg's book, but he doesn't seem
to address KmlLayer, and his examples don't include it, at least in
Chapter 9. Can anyone point me in the direction of a KmlLayer-based
map which uses clustering?

Rossko

unread,
Oct 22, 2010, 3:03:33 PM10/22/10
to Google Maps JavaScript API v3
> Can anyone point me in the direction of a KmlLayer-based
> map which uses clustering?

Usng KmlLayer means that the placemarks are parsed and rendered at
Google's servers, and passed to the webpage map as pre-rendered tile
imagery.
There's no way to influence how Google's servers render it.
Conclusion ; you can't cluster raw KML.

You can parse KML (but not KMZ) at the client, which then allows you
to manipulate the result however you wish. However ... trying to do
that with 3,200 placemarks will cause most user's browsers to croak.

KML itself allows you to specify levels-of-detail and multiple regions
of differing visibility. That can allow you to have a set of
placemarks at some zoom levels, that appear to be replaced by a
different set of placemarks at deeper zooms - analogous to clustering.
http://code.google.com/apis/kml/documentation/regions.html
I've no idea how well KmlLayer supports that feauture though, just
because it's in the KML spec doesn't mean it is supported in all KML
parsers.
Reply all
Reply to author
Forward
0 new messages