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

more accurate area and length calculation #193

Merged
merged 7 commits into from
Oct 30, 2020
Merged

Conversation

tyrasd
Copy link
Member

@tyrasd tyrasd commented Jul 16, 2019

makes formulas partially account for the non-spherical shape of the earth (but keeps using spherical approximation for the calculations).

resulting relative errors are now consistently below 0.1% for "small" features (as typically found in OSM). for comparison: before, areas were sometimes off by a few percent, and lengths typically below half a %

also moves a few implementation functions from public to private

Changes proposed in this pull request:

Type of change

  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

  • My code follows the code-style rules and I have checked on the static analyses and benchmark (if applicable) results
  • I have commented my code
  • I have written javadoc (required for public methods)
  • I have added sufficient unit tests
  • I have made corresponding changes to the documentation
  • I have updated the CHANGELOG.md

🚧 WIP

  • check math
  • benchmark?
  • additional length tests?

@tyrasd tyrasd force-pushed the feature-geometry-precision branch from 4fe61d1 to c493393 Compare July 16, 2019 15:27
@tyrasd tyrasd changed the title [WIP] more accurate area and length calculation 🚧 more accurate area and length calculation Aug 7, 2019
Copy link
Member

@rtroilo rtroilo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't do the math, so I hope this is right, but the code looks good :-) 👍

@tyrasd tyrasd added this to the release 0.6.0 milestone May 7, 2020
@joker234 joker234 force-pushed the feature-geometry-precision branch 2 times, most recently from a45c158 to f65c1db Compare October 29, 2020 16:17
makes formulas partially account for the non-spherical shape of
the earth (but keeps using spherical approximation for the
calculations).

resulting relative errors are now consistently below 0.1% for
"small" features (as typically found in OSM).
for comparison: before, areas were sometimes off by a few percent,
and lengths typically below half a %
Copy link
Member

@joker234 joker234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code change looks good

@joker234 joker234 force-pushed the feature-geometry-precision branch from f65c1db to b1c07df Compare October 29, 2020 18:07
@joker234 joker234 self-requested a review October 29, 2020 18:10
@tyrasd tyrasd changed the title 🚧 more accurate area and length calculation more accurate area and length calculation Oct 30, 2020
@tyrasd
Copy link
Member Author

tyrasd commented Oct 30, 2020

I think this is ready to be merged. Benchmarks would still be nice, but I think the higher accuracy should be worth it in any case. Also, this only adds a few more trig calls, so the performance should be in the same ballpark as before.

@tyrasd tyrasd merged commit 1d9ed3d into master Oct 30, 2020
@tyrasd tyrasd deleted the feature-geometry-precision branch October 30, 2020 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants