How to set color for MapkitJS Clustered Annotation

Hi

I'm working with MapkitJS and able to set the color and Glyph of my Annotations fine.


However, I'm hoping to cluster, and when I set the clusteringIdentifier the annotation reverts back to the default red background color. Where do I set this value?


Thanks


Roy / rverrips

Post not yet marked as solved Up vote post of rverrips Down vote post of rverrips
2.2k views

Replies

>annotation reverts back to the default red background


Default fill color for marker is red; default for glyph is white. What color are you using for your glyphs?


>when I set the clusteringIdentifier


Show that code, in context, pls., thanks.

Post not yet marked as solved Up vote reply of KMT Down vote reply of KMT
  • did you ever get this to work

Add a Comment

The map.annotationForCluster function can be overridden to accomplish this.


Example:

map.annotationForCluster = function(clusterAnnnotation) { clusterAnnotation.color = clusterAnnotation.memberAnnotations[0].color };


More info is available in the MapKit JS Documentation:

https://developer.apple.com/documentation/mapkitjs/mapkit/map/2991319-annotationforcluster