[openstreetmap/openstreetmap-website] Add kilometers/miles switch to directions (PR #5915)
Minh Nguyễn
notifications at github.com
Thu Apr 10 22:15:07 UTC 2025
@1ec5 commented on this pull request.
> } else {
- return OSM.i18n.t("javascripts.directions.distance_km", { distance: Math.round(m / 1000) });
+ const ft = m / ftSize;
+ const mi = m / miSize;
+ if (ft < 1000) {
For what it’s worth, the [MapLibre Navigation SDK](https://github.com/maplibre/maplibre-navigation-ios/blob/f91faffa1aa03be16fc588dc5076b7811d1c5166/MapboxCoreNavigation/DistanceFormatter.swift#L146-L160) switches at 1,000 meters = 1 kilometer, 176 yards = 1 mile for the UK, or 528 feet = 1 mile for the U.S. (ignoring the rounding increments that are applied for readability at a glance). [Ferrostar](https://github.com/stadiamaps/ferrostar/blob/f10b01c03bec9554a7cf827327795d253ad4c1f0/apple/Sources/FerrostarCarPlayUI/Measurement/MKDistanceFormatterUnits.swift#L36-L54) switches at 1,000 meters = 1 kilometer, 300 yards = 0.17 miles for the UK, or 289 feet = 0.16 miles for the U.S. These navigation SDKs don’t aim for equivalent thresholds between measurement systems, since most users aren’t switching back and forth between them.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5915#discussion_r2038424247
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5915/review/2758558352 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250410/792d7503/attachment.htm>
More information about the rails-dev
mailing list