-
Notifications
You must be signed in to change notification settings - Fork 944
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
Update distance measurement factors #635
Comments
Please provide more context for you issue.
Closing this issue. |
its not the formula issue, but the problem is the earth radius being used is not the radius used in google earth. |
Official google earth's radius is 6378137meters.
|
👍 Agreed You could send a PR with a fix for https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/index.js#L264-L276 |
I have send a PR, but it failed for some reason. I donno why. I'm new to github PR. This was my 1st PR in github. |
My guess would be that, since the helper functions are used everywhere, changing their numerical behavior has affected unit tests throughout the entire library. One of the errors on travis-ci is an expected output not matching a fixture. Changing these constants will probably require going through and addressing all downstream unit tests that depend on the helper functions that rely on these constants. |
So could you suggest a fix or can u fix it? |
I suggest you look at the travis-ci report and inspect at each unit test error returned in your PR. The error tells you what was the expected value and what was the actual value. Track down the cause of the difference and you'll likely see that some distance calculation is the root cause. Then update those tests. |
@dpmcmlxxvi Exactly. @dhivehi I pushed a commit to your PR b7e826a which should of updated the the libraries that depend on The only things that really changed was the var factors = {
miles: 3963.190592,
nauticalmiles: 3443.918467,
degrees: 57.2957795,
radians: 1,
inches: 251107755.9055118,
yards: 6975215.442,
meters: 6378137,
metres: 6378137,
kilometers: 6378.137,
kilometres: 6378.137,
feet: 20925646.325459316
}; |
So does this means now the issue is fixed? |
It will be fixed in the next minor/patch release, just waiting for a response from @tmcw or @morganherlocker (if it's OK with them I can submit the release). The |
Ok. Thanks |
I am 👍 on making turf-distance more accurate, but it will require a major @turf/turf version, because it will be a breaking change at the API level. Also please note, that this change does not mean we will officially support "Google" distance in any way. We will not make any change to match a particular 3rd party software's behavior and would not classify a future drift in behavior as a bug. In fact, I would prefer a different source for this measurement that is independent of any vendor to avoid any misunderstandings around expectations. |
@dhivehi Can you provide some other sources that confirm these distance factors. @morganherlocker Should we revert the PR & make a OR Keep it merged and not publish a release until we release a Major one. |
@DenisCarriere We can publish a v4 release anytime. A major release does not need to be particularly "dramatic" -- it simply signals to a user that behavior may have changed in a way that could break dependent libraries. (not all libraries treat versioning this way, but turf has followed semver pretty strictly since v1.0.0 several years ago). .... that said. I can also see a case made that this change simply "fixes" the distance module by making it more accurate and should therefore be considered a |
Ok! Sounds good, I'm thinking this should be a patch This earth radius factor is the same as WGS84. Also GDAL uses the same earth radius. We can announce the patch change in the Issues. |
Published Major Release v4.0 to fix this issue. |
@DenisCarriere @morganherlocker @dhivehi The Harvesine approximation for Earth usually uses mean radius rather than equator radius, and mean radius equals 6371008.8 meters (which most formulas round to 6371km). So this patch actually made distances less precise on average. |
👍 @mourner Thanks for the enlightenment, what do you propose we do? I can't help revert it back if that's your recommendation. I'm also going to assume that all the other |
@DenisCarriere I'd suggest reverting, or maybe changing to
|
Closed due to #635 (comment) |
Turf line distance calculation is not accurate according to google earth. Is there any way to use custom radius in calculation?
The text was updated successfully, but these errors were encountered: