Skip to content

Demetricate elevations #9

Open
Open
@1ec5

Description

@1ec5

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 and min_height
  • state_label and water_label layers: area
  • road_label layer: len
  • mountain_peak_label layer: elevation_m (use elevation_ft)

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.

/cc @lukasmartinelli @anandthakker

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions