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

Update GeoJSONSource.clusterProperties to support [["+", ["accumulated"], ["get", "sum"]], ["get", "scalerank"]]

Open nflahavan opened this issue 3 years ago • 1 comments

New Feature

I would like to be able to use GeoJSONSource.clusterProperties with Operator.accumulated.

Why

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.

nflahavan avatar Jul 23 '22 00:07 nflahavan

@ZiZasaurus is there a way to express [["+", ["accumulated"], ["get", "sum"]], ["get", "scalerank"]] with the current state of the iOS mapbox SDK? I can't seem to figure out a way to do it.

nflahavan avatar Aug 03 '22 17:08 nflahavan

re-opened as a bug https://github.com/mapbox/mapbox-maps-ios/issues/1571

nflahavan avatar Sep 09 '22 16:09 nflahavan