mapbox-maps-ios icon indicating copy to clipboard operation
mapbox-maps-ios copied to clipboard

clusterProperties does not fully support Style Specification.

Open nflahavan opened this issue 3 years ago • 0 comments

Environment

  • Xcode version: 13.4.1
  • iOS version: 15.6.1
  • Devices affected: All devices are affected.
  • Maps SDK Version: v10.8.0

Observed behavior and steps to reproduce

it is not possible to express [["+", ["accumulated"], ["get", "sum"]], ["get", "scalerank"]] via Expression, therefore it is not possible to use [["+", ["accumulated"], ["get", "sum"]], ["get", "scalerank"]] to express a cluster property.

Expected behavior

I expect to be able to use [["+", ["accumulated"], ["get", "sum"]], ["get", "scalerank"]] as a value in the dictionary clusterProperties.

Notes / preliminary analysis

In order to express [["+", ["accumulated"], ["get", "sum"]], ["get", "scalerank"]] and other such expressions, the type for the value of the clusterProperties dictionary must support an array of two expressions.

I believe this can be accomplished by adding another Operator called expression with associated value of type Expression. This will require removing String raw type from the enum. Custom encoder/decoder function/init will need to be added as well.

Another possible solution is to change the type of clusterProperties to [String: [Expression.Element]]. This simple solution is less type safe but much easier to implement. It would be nice to make Expression.elements public if this route is taken.

Additional links and references

clusterProperties Style spec

clusterProperties API spec

nflahavan avatar Sep 09 '22 16:09 nflahavan