I created an example Android app with MapBox, where I have 3 SymbolLayers with GeoJsonSources.
Each layer has a different icon ("NEW", red, and blue marker), and on each layer I add 500 points randomly in the US.
Zooming in and out makes some icons appear/disappear. Apparently, there is some sort of auto-clustering going on.
This is how it looks like when you zoom out a lot:

This is how I initialized the layers:
private void initLayer(String prefix, @DrawableRes int icon) {
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), icon);
this.mapboxMap.addImage(prefix + "-marker-image", bitmap);
SymbolLayer markers = new SymbolLayer(prefix + "-marker-layer", prefix + "-marker-source")
.withProperties(PropertyFactory.iconImage(prefix + "-marker-image"));
switch (prefix) {
case "new":
this.mapboxMap.addLayer(markers);
break;
case "red":
this.mapboxMap.addLayerBelow(markers, "new-marker-layer");
break;
case "blue":
this.mapboxMap.addLayerBelow(markers, "red-marker-layer");
break;
}
FeatureCollection featureCollection = FeatureCollection.fromFeatures(new ArrayList<Feature>());
Source geoJsonSource = new GeoJsonSource(prefix + "-marker-source", featureCollection);
this.mapboxMap.addSource(geoJsonSource);
}
This is what I tried, but what doesn't work:
Source geoJsonSource = new GeoJsonSource(prefix + "-marker-source", featureCollection,
new GeoJsonOptions().withCluster(false));
Is there a different way to switch this clustering off?
Is it even intended to be there?
Platform: Android 7.1.1, OnePlus 3T
Mapbox SDK version: 5.1.0
All points that I added are visible all the time.
Only few points are visible when zoomed out.
By default, symbol layers are tailored for text labeling, where collisions are undesired. To allow symbol collisions, set the iconAllowOverlap and iconIgnorePlacement properties of your layer to true.
Most helpful comment
By default, symbol layers are tailored for text labeling, where collisions are undesired. To allow symbol collisions, set the
iconAllowOverlapandiconIgnorePlacementproperties of your layer to true.