-
Notifications
You must be signed in to change notification settings - Fork 57
new distance system & maximum fraction digits #661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
web/index.html
Outdated
| valhallaEndpointUrl="https://api.stadiamaps.com/route/v1" | ||
| styleUrl="https://tiles.stadiamaps.com/styles/outdoors.json" | ||
| profile="bicycle" | ||
| system="imperial" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
Sorry for the delay getting back to this @tedi4t! I was traveling for the past week or so and this got buried. Another contributor had been working on further splitting the responsibilities between the core and the map widget in #6622, which created a few conflicts. I think I've resolved all of the conflicts now. The only outstanding issue I have is that it seems to show decimal places for the "smaller" units. While it's quite reasonable to display something like 0.9 mi or 1.2km, I don't think anyone cares about fractional meters, feet, or yards ;) GPS isn't even that accurate anyways.
|
ianthetechie
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latest changes address some of the issues. For example, feet are no longer shown with a decimal value. However, there are a few problems outstanding.
- There is a very long stretch where "1 mi" is displayed. For very long distances, yes, we should hide the precision. But typically between 1 and 10 miles (or kilometers), you'd want a slightly more granular display (1 - 2 digits?).
- The thresholds do not seem to be aligned between when the library switches to feet, and when we do the cutoff here. For example, at this point in the route, there's a significant period of time where we display "0 mi" which isn't very helpful. These should be aligned. Perhaps some of this code belongs in a PR in the formatters library instead, so we can have a holistic view of which unit we're showing and make decisions based on that? (We should never show fractional feet, yards, or meters, but we should SOMETIMES show fractional miles and kilometers).
0a15c28 to
72ad5f3
Compare
|
Hello, |
|
Hmm... I'm using the PR branch with no changes locally. I just click "Simulate navigation" and for the longest time it just shows "1 mi" (and even eventually "0 mi" for a short bit) with no further detail. Then it eventually switches to feet.
My point here is that right now there's code within the formatters library which determines the distance at which we switch between, say, miles and feet, or km and meters. This is problematic for a few reasons. The user of the library code has no idea where the switch (e.g. miles -> feet) happens. Since all we pass is a maximum number of fraction digits, and we don't know the switch-over point, it's essentially impossible to guarantee it behaves as desired. Looking at the code over there, it looks sane enough for metric, but doesn't really make any sense for either imperial setting. I think we can just hard code this in the formatters library since it's pretty narrow in purpose. Here's the reference logic from Android: Line 74 in 0b981e6
|
|
@ianthetechie 1. Remove
|
|
Yeah, I think that sounds like a good plan @tedi4t. Thanks! |
|
@ianthetechie as discussed, created new PR: maptimy/platform-formatters#6 |
|
Leaving this open for the moment, but see the comment on maptimy/platform-formatters#6. We'll try to get this sorted soon and then update this PR (or close it and make a new one?) to use that accordingly. |




No description provided.