Skip to content
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

More statistical expression operators #5892

Closed
1ec5 opened this issue Dec 19, 2017 · 1 comment
Closed

More statistical expression operators #5892

1ec5 opened this issue Dec 19, 2017 · 1 comment
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

Comments

@1ec5
Copy link
Contributor

1ec5 commented Dec 19, 2017

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

@1ec5 1ec5 added 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 labels Dec 19, 2017
@1ec5
Copy link
Contributor Author

1ec5 commented Dec 19, 2017

Duplicate of #5853.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

1 participant