You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now that expression support has landed in GL JS master, this plugin can demetricate any length measurements that occur in labels if the user agent specifies a U.S. locale, based on the following properties in the Mapbox Streets source:
Of these properties, height, min_height, and elevation_m/elevation_ft are the most likely to appear in labels. area and len are projected areas and lengths, respectively, which aren’t particularly practical for labeling.
For most of these properties, we’ll need to introduce expressions that convert between meters and feet or between square kilometers and square miles or acres. This will require the library to use the new expression syntax instead of the legacy property function syntax, although perhaps we could detect the absence of expression support and still adjust property functions if needed.
For elevation_m, we’ll simply switch to elevation_ft. One challenge will be localizing units that are written out alongside the property: for example, the mountain_peak_label documentation recommends specifying a text field of {elevation_m}m, but {elevation_m} meters could occur instead.
Demetrication should be an option, not mandatory, since meters are used in technical contexts in the U.S.
This will require the library to use the new expression syntax instead of the legacy property function syntax, although perhaps we could detect the absence of expression support and still adjust property functions if needed.
Once the number-format expression operator introduced in mapbox/mapbox-gl-js#7626 is adopted by Mapbox Studio, this plugin should use it to format numbers in elevations at the same time that it converts the elevations to the appropriate unit.
Now that expression support has landed in GL JS master, this plugin can demetricate any length measurements that occur in labels if the user agent specifies a U.S. locale, based on the following properties in the Mapbox Streets source:
building
layer:height
andmin_height
state_label
andwater_label
layers:area
road_label
layer:len
mountain_peak_label
layer:elevation_m
(useelevation_ft
)Of these properties,
height
,min_height
, andelevation_m
/elevation_ft
are the most likely to appear in labels.area
andlen
are projected areas and lengths, respectively, which aren’t particularly practical for labeling.For most of these properties, we’ll need to introduce expressions that convert between meters and feet or between square kilometers and square miles or acres. This will require the library to use the new expression syntax instead of the legacy property function syntax, although perhaps we could detect the absence of expression support and still adjust property functions if needed.
For
elevation_m
, we’ll simply switch toelevation_ft
. One challenge will be localizing units that are written out alongside the property: for example, themountain_peak_label
documentation recommends specifying a text field of{elevation_m}m
, but{elevation_m} meters
could occur instead.Demetrication should be an option, not mandatory, since meters are used in technical contexts in the U.S.
/cc @lukasmartinelli @anandthakker
The text was updated successfully, but these errors were encountered: