Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
89 views
in Technique[技术] by (71.8m points)

MapBox NumberFormat expected syntax

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

question from:https://stackoverflow.com/questions/65858085/mapbox-numberformat-expected-syntax

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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' }
]

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...