I'm trying to implement clustering in Mapbox for iOS and literally using this example from Mapbox website
It works fine, but I'd like to be able to use simple MGLAnnotations to place on the map and cluster them together if they are too close.
I read here that MGLShapeSource not only accepts external geoJSON, but other sources, such as polylines and annotations. But when I feed it with annotations array no clustering occur, I just see bunch of my markers from my annotations array:
let source = MGLShapeSource(identifier: "clusteredParkings", shapes: annotationsArray, options: [.clustered: true, .clusterRadius: 20])
When I swap the source back to geoJSON everything works again for clusters. Btw there are no errors or warnings.
What am I doing wrong? Does anyone have a working example of Mapbox clustering with MGLAnnotations rather than geoJSON source file?
https://www.mapbox.com/ios-sdk/api/3.6.0/Classes/MGLShapeSource.html
I did some research on this not too long ago and it didn't seem to be possible on iOS. Here is the suggestion on github that is still open. Here is another issue about how it wasn't mentioned in the documentation but has since been added.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With