Back to top
Clusterer[View source code.] [View example.]This object is an add-on for the Google Maps API. It lets you handle large numbers of markers, thousands if you like, without the slow performance you'd get if you tried displaying them via the maps API directly. Clusterer uses two techniques to accomplish this: * Only the markers currently visible actually get created. * If too many markers would be visible, then they are grouped together into cluster markers.Using Clusterer is very easy. 1. Load the routines into your code: <script src="http://www.acme.com/javascript/Clusterer2.jsm" type="text/javascript"></script> (If your map is still using API v1, use Clusterer1.jsm instead.) 2. Create a Clusterer object, passing it your map object: var clusterer = new Clusterer(map); 3. Wherever you now do map.addOverlay(marker), instead call clusterer.AddMarker(marker, title). The title is just a short descriptive string to use in the cluster info-boxes. 4. If you are doing any map.removeOverlay(marker) calls, change those to clusterer.RemoveMarker(marker).That's it! Everything else happens automatically.There are also a few routines to change the default behavior: 1. If you don't like the default large blue cluster icon, you can call clusterer.SetIcon(icon) to change it. 2. clusterer.SetMaxVisibleMarkers(n) lets you change the threshold marker count where clustering kicks in. The default is 150 markers. 3. clusterer.SetMinMarkersPerCluster(n) sets the minumum number of markers for a cluster. The default is five. 4. clusterer.SetMaxLinesPerInfoBox(n) sets the maximum number of lines in an info box. The default is ten, but if your map is small this may be too many.
Copyleft: Tutto il materiale pubblicato o comunque presente all'interno del sito www.joomla.it può essere utilizzato, diffuso e modificato liberamente. Hosting fornito gratuitamente da Joomlahost.it Disegno web da kreatif multimedia srl