-
Notifications
You must be signed in to change notification settings - Fork 502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for symbols clustering #515
Comments
Now that the PR #1168 is merged for the mapbox plugins for android regarding symbols clustering, what is the requirement to get this update in the flutter plugin ? I mean, does the behavior will be native as for iOS ? Or else, do we have to declare a specific parameter in the MapboxMap() widget to activate symbol clustering ? |
@Kephas3 It seems that all of the Still, looking into mapbox annotation plugins, it looks like internally they still rely on GeoJSON features. So having clustering now work in Android annotation plugin, maybe there is a way to wire it in instead of using geojson manually in Flutter. Would be great to get some more in-depth input from Mapbox devs, what would be the best approach. The problem I see is that iOS annotation plugin doesn't seem to support clustering. Looks like it is tracked here mapbox/mapbox-plugins-ios#6, but it's silent since 2017. |
Closed by #797 |
@m0nac0 Does proper symbol clustering work already? I though geoJSON support only adds geoJSON, but clustering needs to be a separate PR |
#797 states:
And that PR does indeed add the clustering options. If I remember correctly, it should be sufficient to create a new source with clustering enabled and a corresponding layer. |
The biggest downside of Mapbox SDK approach is required support of GeoJSON. If you will want to have clustering you would have to force your API or data to be in GeoJSON format, even if you don't have tremendous amount of points to cluster.
Android
Sample from Mapbox SDK: https://docs.mapbox.com/android/maps/examples/circle-layer-clustering/
In official mapbox documentation, symbols clustering works through a strange combination of multiple layers:
While it is not clear exactly from Mapbox SDK documentation, looks like all of mapbox layers have
setFilter
method that seems to be somehow connected to GeoJSON itself, filtering its data.Even though the whole approach looks totally confusing, most likely this is what we will have to use to implement in flutter.
At the moment, single symbol layer is not yet exposed into flutter, symbols and circles use annotation plugin on Android, that rather leverages SymbolManager from the plugin.
GeoJSON support is also missing, only FillManager adding support for Fill (#71)
iOS
Sample from Mapbox SDK: https://docs.mapbox.com/ios/maps/examples/clustering/
For unknown for me reason, default behavior on IOS is to cluster symbols even without any implementation for circles provided. SDK seems to just do it by default which is very confusing, because visually all points look the same.
The approach to support clustering on iOS is very similar to that of Android. The main difference is that iOS seems to support more advanced expressions to work with GeoJSON, so there is no need to have multiple circle layers, there is only one that uses more advanced formulas.
GeoJSON is represented by
MGLShapeSource
class. There is alsoMGLSymbolStyleLayer
andMGLCircleStyleLayer
that have apredicate
property - it seems to accept some kind of advanced formula that can be used to change properties of the layer itself. Additionally, other properties can acceptNSExpression
, that allows to use more formulas to change the values.If anybody knows iOS SDK better, please link documentation for this
predicate
feature.Potential tasks
The text was updated successfully, but these errors were encountered: