Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Document that clustering requires GeoJSON sources #7821

Closed
jmkiley opened this issue Jan 23, 2017 · 7 comments
Closed

Document that clustering requires GeoJSON sources #7821

jmkiley opened this issue Jan 23, 2017 · 7 comments
Assignees
Labels
documentation iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS
Milestone

Comments

@jmkiley
Copy link
Contributor

jmkiley commented Jan 23, 2017

The documentation for MGLShapeSourceOptionClustered does not mention that you currently can only cluster shapes with a GeoJSON source. This may be confusing for users who want to cluster point annotations (#5814), for example.

/cc @1ec5 @friedbunny

@jmkiley jmkiley added documentation iOS Mapbox Maps SDK for iOS labels Jan 23, 2017
@friedbunny friedbunny added this to the ios-v3.4.1 milestone Jan 23, 2017
@jmkiley jmkiley self-assigned this Jan 24, 2017
@1ec5
Copy link
Contributor

1ec5 commented Jan 25, 2017

#7837 is adding this documentation.

@1ec5 1ec5 added the macOS Mapbox Maps SDK for macOS label Jan 25, 2017
jmkiley added a commit that referenced this issue Jan 25, 2017
* [ios] Clarify that shape source needed for clustering. Fixes #7821.
@friedbunny
Copy link
Contributor

Fixed in #7837.

@nitrag
Copy link
Contributor

nitrag commented Feb 25, 2017

Why is clustering only available in MGLShapeSource and not MGLVectorSource? Is there some limitation?

@1ec5
Copy link
Contributor

1ec5 commented Feb 28, 2017

@nitrag, great question. According to @mourner, it has to do with the fact that the clustering algorithm needs all the data to be loaded, whereas with vector sources, tiles come in asynchronously. Please open a separate issue to request this feature. Be sure to explain your use case so we can discuss the best way to support it.

@jbarros35
Copy link

I wanted to do that dynamically. Using geoJSON files it's just stupid.

@michzio
Copy link

michzio commented Jul 25, 2019

No it works for me with MGLPointFeature
I am doing MGLPointAnnotation to MGLPointFeature simple conversion

 let features = Array(mapPoints.values).map { $0.pointFeature }
        let source = MGLShapeSource(identifier: "clusteredRestaurantsSource",
                                    //url: url,
                                    features: features,
                                    //shapes: Array(mapPoints.values),
                                    options: [.clustered : true,
                                              .clusterRadius : icon.size.width,
                                              .maximumZoomLevelForClustering: 16])

@vikihleblya
Copy link

vikihleblya commented Sep 17, 2019

@michzio, please, can you say what type is mapPoints in your code? Do you request your points once or you do it periodically? My problem is that I request all my points for some area on screen and when I drag to other location, I request points again. That's why I can't fully understand at which sequence I need to code.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS
Projects
None yet
Development

No branches or pull requests

7 participants