Get properties of the best/max element with cluster properties
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
mapbox-gl-js version: 1.2.0
Question
I have a GeoJSON feature collection of points which I'm clustering, with the following properties:
properties: {
name: string,
value: number,
}
I'm trying to get in the clusterProperties the name with the highest value. I've managed to get the max value using the following expression: ['max', ['get', 'value']], but I don't know how to get the name or other fields of the best element.
How should this expression be written?
Links to related documentation
https://docs.mapbox.com/mapbox-gl-js/style-spec/#expressions-max
https://docs.mapbox.com/mapbox-gl-js/style-spec/#expressions-get
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Begin with the linked style-spec sections for max and get, then trace how clusterProperties expressions are handled in the v1.2.0 codebase. Determine whether the name can be retrieved with the maximum value, including the expected behavior for ties. Done means the supported expression or limitation is clearly documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- frontend, web-dev
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100