More statistical expression operators #5892
Labels
cross-platform 📺
Requires coordination with Mapbox GL Native (style specification, rendering tests, etc.)
GL native → GL JS
For feature parity with Mapbox Maps SDK on a native platform
The iOS and macOS SDKs are representing expressions as instances of the NSExpression class. The style specification currently defines some statistical expression operators:
min
(minimum),max
(maximum),length
(count), and+
(summation), but NSExpression defines several more predefined statistical functions. To some extent, Objective-C and Swift developers expect to be able to use most of the predefined NSExpression functions without having to consult a large correspondence table.The following expression operators would improve compatibility with NSExpression:
avg
returns the arithmetic mean (average) value in an array.median
returns the median value in an array.mode
returns the most frequent value in an array.stddev
returns the standard deviation in an array.random
returns a random number. (Which random number and how this would work exactly is left as an exercise to the implementer. 😉)mapbox/mapbox-gl-native#10726 synthesizes
avg
based on+
,length
, and/
, but a native implementation would be preferable./cc @anandthakker @tobrun @lucaswoj
The text was updated successfully, but these errors were encountered: