Layout property proposal: numeric-precision#3361
Conversation
|
I'm not sure that the layer's layout properties is the best place for this bit of metadata. Users would be unable to use different numeric precisions for different I'm excited about exploring string operations in the spirit of mapbox/mapbox-gl-function#28 |
|
Agree 100% with @lucaswoj. |
|
I agree that arbitrary expression functions are much more powerful and may be better suited for this kind of task, although it may take us a very long time to get there. I'm also interested to see how would such an arbitrary expression look for rounding a number. Would we introduce special keywords like |
I think it'd look like a string formatting library in Javascript
Spitballing syntax here, supposing the feature had a property called this.foo.toPrecision(2) |
An alternative solution for #3358. Introduces
numeric-precisionlayout property that affects how numbers are interpolated in text fields. If set,numbers in resolved text fields of a layer will have the specified precision (e.g.
"numeric-precision": 2will make123.45678appear s123.46).This is just a proof of concept; a proper implementation would require corresponding style-spec changes, including settling on a default value there.
cc @danpat @jfirebaugh