Skip to content

feat(ShapeSource): add clusterMinPoints - #4395

Merged
mfazekas merged 2 commits into
mainfrom
feat/cluster-min-points
Oct 26, 2026
Merged

mfazekas merged 2 commits into
mainfrom
feat/cluster-min-points

Conversation

@mfazekas

@mfazekas mfazekas commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes #1955

Added clusterMinPoints to ShapeSource: the minimum number of points needed to form a cluster (default 2). It maps 1:1 to iOS GeoJSONSource.clusterMinPoints and Android GeoJsonSource.Builder.clusterMinPoints(Long), both available since SDK 11.5, so it works on the current default 11.23.1. It is also passed through on web (mapbox-gl clusterMinPoints) and when reading a GeoJSON source from Style JSON.

Like clusterRadius, the value is applied when the source is created. I tried a live setSourceProperty("clusterMinPoints") and the core rejected it on iOS (Cannot set property 'clusterMinPoints' for the source), so changing the value means remounting the ShapeSource. The prop docs say so.

Checklist

  • I've read CONTRIBUTING.md
  • I updated the doc/other generated code with running yarn generate in the root folder
  • I have tested the new feature on /example app.
    • In V11 mode/ios
    • In New Architecture mode/ios
    • In V11 mode/android
    • In New Architecture mode/android
  • I added/updated a sample - if a new feature was implemented (/example)

Screenshot OR Video

The Earthquakes example now has a button that switches clusterMinPoints between 2 and 10, remounting the source via key. I tested it on the iOS simulator (iPhone 17 Pro, iOS 26.5) and an Android emulator (Pixel 6). Both behaved the same. At 2 the map shows the usual clusters of 5, 8 and 9 points. At 10 those groups render as individual points, and only clusters of 10 or more remain (274/275, 39/40, 17/18). Switching back to 2 restores the original clusters.

4395-clusterMinPoints-2 4395-clusterMinPoints-10

@mfazekas
mfazekas merged commit 5839142 into main Oct 26, 2026
19 of 20 checks passed
@mfazekas
mfazekas deleted the feat/cluster-min-points branch October 26, 2026 07:29

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

clusterMaxZoom, clusterMinPoints not working on all versions

1 participant