Alzemic
Alzemic

Reputation: 11

Mapbox Maps iOS - Show unclustered image as an icon in the clustered layer

I'm using GeoJSONSource to show images on the map (like images on the map in Apple Photos). Those images are loaded from the FeatureCollection object and first thing I do is to add them to map style. I need clustering of course (circle with a number) but what I can't do is to show one of those images as a cluster image with a number (and a circle too) just as in Apple Photos app. So the main question is how to preserve one of images that are clustered together?

var source = GeoJSONSource()
source.data = .featureCollection(featureCollection)
source.cluster = true
source.clusterRadius = 40
source.clusterMaxZoom = 18
source.clusterProperties = [
   "cluster_image": Exp(.coalesce) {
      Exp(.get) { "cluster_image" }
      "circle-icon"
   }
]

clusterProperties is something I find out by searching about this problem and Mapbox AI also suggested but it still doesn't work. Currently, since clustering is set to true, circle with a number overlaps images which is expected behaviour I guess.

Using: Mapbox Maps 10.18.2

Upvotes: 0

Views: 19

Answers (0)

Related Questions