简体   繁体   中英

How to cluster points with different images (icons)? MapBox

Friends, I need to cluster points with different pictures (icons). Could you tell me by what means I can do it? How do this with the mapbox iOS SDK.

Task: From the server I receive around 2000 images, each image corresponds to a certain coordinate. When I got their point data with an image, I'm adding a cluster to the map.

I want to see something like this on my map: enter image description here

SymbolStyleLayers can only have one image for all points.

Do you need to be able to tap these to perform an action? That only works with features added to a MGLSymbolStyleLayer, and you'll want to add them as features, not regular PointAnnotations.

If not, I would just subclass MGLPointAnnotationFeature and have an attributes item for the UIImage, and use the delegate method imageForAnnotation to see if the annotation is of your subclass, and, if so, return the UIImage packaged into an MGLAnnotationImage.

In order to cluster points with different icons - there is a library.

https://github.com/hulab/ClusterKit

This proved to be the solution to my problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM