MapBox NumberFormat expected syntax

457 Views Asked by At

I'm struggling a lot with MapBox Studio

I need to format elevation and use the numberFormat function.

However, I didn't succeed to find the right syntax. The documentation is very poor.

So far I did try to do this:

number-format(elevation, {'locale':'fr'})

but it keep says syntax is not correct. Tried double quote, tried also to add.

I found this only information:

Converts the input number into a string representation using the providing formatting rules. If set, the "code" argument specifies the locale to use, as a BCP 47 language tag. If set, the currency argument specifies an ISO 4217 code to use for currency-style formatting. If set, the min-fraction-digits and max-fraction-digits arguments specify the minimum and maximum number of fractional digits to include.

Mapbox Studio attempt to use  NumberFormat function

1

There are 1 best solutions below

0
On

The right syntax to use seems to be documented there : https://docs.mapbox.com/mapbox-gl-js/example/cluster-html/

For my need, the right way to do it was

[
'number-format',
['get', 'elevation'],
{ 'locale': 'fr' }
]