MBTiles + MBStyle: highway shields not shown

Description

This happens because the highway shield is referenced as:

"icon-image": "road_{ref_length}"

When the dataset is a MBTiles, there is no way to know if ref_length is an integer, a double, or what, so Double is picked. When the two are composed, the reference ends up being "road_3.0" while the sprite file contains "road_3".

Two possible approaches come to mind:

  • Declare the feature type as having Number and then use the smallest possible type (e.g., Integer in this case) on parse. Downside, not sure the rest of the code is ready for "Number".

  • When a numeric field if used int the style, wrap with a number formatting function that removes the decimals. Downside: it's a data source specific workaround placed in a styling module.

Maybe a compromise is to mark the datatype as uncertain in the userdata of the attribute descriptor, in MBTiles, and then have MBStyle recognize that case and wrap with the number formatting function as a consequence.

do you have a preference or another suggestion?

Environment

None

Assignee

Andrea Aime

Reporter

Andrea Aime

Triage

None

Components

Fix versions

Priority

Medium
Configure