-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix: Apply correction to distanceToLine() measurements #767
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #767 +/- ##
==========================================
+ Coverage 39.09% 39.10% +0.01%
==========================================
Files 71 71
Lines 4088 4089 +1
Branches 609 609
==========================================
+ Hits 1598 1599 +1
Misses 2387 2387
Partials 103 103
Continue to review full report at Codecov.
|
|
help me |
|
help |
|
Hi @barbeau . Can this PR be revived? I have been checking it and seems that solves the original problem. What would it need, further test coverage? |
|
Hey @kikoso! Yes, I'd love to see this get merged. See the unchecked checkbox in the original comment - I was hoping to add test coverage to confirm this fixed the issue and prevent it from getting broken again in the future. I don't currently have the bandwidth to work on this, but if you'd like to pick it up feel free. |
|
Hi @barbeau . I have added a few tests reflecting different latitudes and magnitudes. I have also added a case for a segment in a different hemisphere than the point, since this is an interesting edge case. Distances have been verified using QGIS Regarding the accuracy: I can't find too much about how accurate the algorithm is, or what is the accuracy expected. Do we need to document this in the Thanks. |
Thanks for this!! 💯
In the interest of getting this actually merged, I think as long as you've manually verified the measurements in QGIS that should be sufficient. IIRC the original thought was to include sufficient precision in the unit tests that someone could confirm it was accurate to X decimal places. To make sure future maintainers know this, can you please add a comment above those unit tests indicating they they were manually verified in QGIS? Other than that, IMHO this should be good to merge now, although I'd welcome reviews by others. |
|
For future reference, when I was originally looking at this the point-to-line algorithm seemed to be http://paulbourke.net/geometry/pointlineplane/ or http://geomalgorithms.com/a02-_lines.html (the algorithm implementation pre-dates me). I added a comment for this in the code. |
|
@barbeau , that makes sense. I have added some comments providing a background introduction to this topic. Let me know what you think. Thanks! |
|
LGTM, thanks! |
|
@wangela, feel free to take a last look. |
## [2.4.1](v2.4.0...v2.4.1) (2023-01-05) ### Bug Fixes * Apply correction to distanceToLine() measurements ([#767](#767)) ([59a48d3](59a48d3)), closes [/github.com//issues/720#issuecomment-631263199](https://github.com//github.com/googlemaps/android-maps-utils/issues/720/issues/issuecomment-631263199)
|
🎉 This PR is included in version 2.4.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Please do not merge - work-in-progressThis is an implementation of a fix mentioned in #720 (comment) for a bug in the distance from a point to a line segment measurement.
TODO:
Dthat should be measured for each point is below.distanceToLine()method so developers understand the accuracy limitations of the current implementation. For example, if we only expect the algorithm to be accurate within 1 meter when measuring a distance of 10,000 meters between a line segment and point, there shouldn't be any decimal points in thedeltavalue passed toassertEquals(). And the Javadocs should include a note about level of accuracy at this distance.(Google Slide)
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
BREAKING CHANGEfooter so when this change is integrated a major version update is triggered. See: https://www.conventionalcommits.org/en/v1.0.0/Fixes #720 🦕