I am using Google Maps SDK in my app and drawing markers on selected let and making groups on markers I am using GMUClusterManager to add clusters on markers but with this I am facing an issue to change Image of markers, if I draw markers with GMUClusterManager then there is no option to change marker image. So when user zooms in the map or changes the image of the maker, does anyone know any other way to make a group of all markers.
After creating the delegate for your
GMUDefaultClusterRenderer, I used the view controller I was using and then Implemented GMUClusterRendererDelegate
let icOnGenerator= GMUDefaultClusterIconGenerator() let algorithm = GMUNonHierarchicalDistanceBasedAlgorithm() let renderer = GMUDefaultClusterRenderer(mapView: mapView, clusterIconGenerator: iconGenerator) renderer.delegate = self clusterManager = GMUClusterManager(map: mapView, algorithm: algorithm, renderer: renderer)
After that, you implement the
func renderer(_ renderer: GMUClusterRenderer, willRenderMarker marker: GMSMarker) protocol. Through this method you can access the marker and the data contained in the marker. Use the If let statement to access the data and provide the required iconView for the marker
if let markerData = marker.userData