Google Maps doesnβt provide the ability to split multiple markers located in the same place. This can happen to people or businesses in several places of residence, for example, in a residential building or professional services building. Depending on the zoom level, it can also occur in shopping centers, etc.
How to do this, "spiderfy" them: when you click on the first one, it breaks them with a line into the location. This is done on Google Earth, and George McCarron wrote a package for Google Maps. ( https://github.com/jawj/OverlappingMarkerSpiderfier )
It can be integrated with markerclusterer, although it does not support the creation of clustered marker markers.
My problem is that the application I'm working on wants to have specific icons for different activities. Spiderfier places one of the markers on top. The person looking at the map does not know that there can be 10 or more other markers under the top marker.
Ideally, there would be a way to place the top marker, which is displayed when there are several markers similar to another icon in the markercluster. This is not 1-to-1 direct, since spiderfier also works when they are close, but not exactly in the same place (20 pixels by default), and markercluster does not provide access to multiple markers in the same place.
The ideal behavior would be to have a special icon for spiders, which during the click attacked individual icons. Like markerclusterer, but without zooming in and handling the same location. A special icon would ideally indicate how many other markers are in place, again like a markerclusterer. A special icon can be hidden or become part of a spiderfied group.
Without any placement, users might not know that several actions are in this place. They may even suggest that the desired activity is not in this place because another activity marker is shown.
This is a plunker that has a problem: http://plnkr.co/edit/vimZNq?p=info
var markers = []; var bounds = new google.maps.LatLngBounds(); for (var i = 0; i < 100; ++i) { var latLng = new google.maps.LatLng(Math.floor(Math.random() * 10) / 10 + 39, Math.floor(Math.random() * 10) / 10 - 100); var marker = new google.maps.Marker({ position: latLng, title: "marker " + i + " pos: " + latLng, maxZoom: 8, map: map }); marker.desc = marker.getTitle(); bounds.extend(latLng); markers.push(marker); oms.addMarker(marker); } map.fitBounds(bounds); var markerCluster = new MarkerClusterer(map, markers);
Thank you for your help,
David