1024programmer Java Custom markers on Google Maps using clusters

Custom markers on Google Maps using clusters

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.

1> DatForis..:

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 markerif let markerData = marker.userData

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/764811

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us


Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top