openstreetmap-americana
openstreetmap-americana copied to clipboard
Scale bar in the demo
The demo currently features no scale bar (unless I missed it somehow). Could one be added? You can make imperial units the default to really show that this is an American map style.
GL JS has a ready-made ScaleControl
that we can enable. Here’s where we start adding controls to the map:
https://github.com/ZeLonewolf/openstreetmap-americana/blob/e0cd6a6d773581311d605022fdf111bec806c4e2/src/americana.js#L74-L78
ScaleOptions
includes an option to switch between metric
and imperial
(customary) units. We could tie that to a URL parameter so the user can choose more familiar units. It could default to metric
unless navigator.language
is en
or en-US
(American English) or has US
as the region code. This would be consistent with how the map defaults to the user’s preferred language, not necessarily American English.
To be precise, imperial
would be appropriate in 🇺🇸🇵🇷🇬🇧 according to CLDR. There are differences between 🇺🇸🇵🇷 and 🇬🇧, and also 🇸🇪 ideally uses Scandinavian miles, but GL JS doesn’t support these nuances.