Skip to content
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

Round up in GeoCoordinateFormatter when close to a degree/minute #93

Merged
merged 1 commit into from
Mar 14, 2017

Conversation

thiemowmde
Copy link
Contributor

@thiemowmde thiemowmde commented Dec 23, 2016

I'm introducing a delta here.

  • In the degree-minute format the minute is not shown (but rounded up to degree) when the precision is almost 1 degree, just 1 minute lower.
  • In the degree-minute-second format the second is not shown (but rounded up to minute) when the precision is almost 1 minute, just 1 second lower.

This compensates for all kinds of rounding errors that can happen when the precision is calculated externally.

I consider this a bugfix because it changes the output of the formatter to be much closer to the users expectation. When the precision is 0.999° it is very surprising to get 1°59'. This makes it look like the precision is 1 second, when in reality it is almost exactly 1 minute.

I was playing around with different thresholds. Note that 30 seconds is a bad threshold. It appears like this will create a situation where the distance to 1 minute is the same as the distance to 1 second. In reality the threshold represents 0.5 minutes, but 30 seconds (2 vs. 30 times).

A perfect threshold would be the square root of 60 = 7.746 seconds, but that would be confusing for users. 10 seconds (represents an actual digit in the output format) would be to much. Something like 5 or 2 seconds would be ok but still be confusing. So I decided to go for 1.

Bug: T158772

@JeroenDeDauw
Copy link
Member

+1

@thiemowmde
Copy link
Contributor Author

With #95 this patch became a lot simpler. Yay!

@brightbyte brightbyte merged commit 15bf59d into master Mar 14, 2017
@brightbyte brightbyte deleted the deltaFormatting branch March 14, 2017 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants