mapbox-java icon indicating copy to clipboard operation
mapbox-java copied to clipboard

Turf distance measurement doesn't match TurfJS

Open ac87 opened this issue 5 years ago • 1 comments

I am trying to port transformRotate from Turf.JS as I need it for a project.

In the method comments there are some examples with the expected result, my port didn't match. In trying to debug this I've noticed that the distance tests don't match between JS and the Java port.

The standard test points [-75.343,39.984][-75.534, 39.123] used the km distance in TurfJS is 97.12922118967835

Those same points are tested in the port but the expected result is different: 97.15957803131901

This third party suggests TurfJS is correct.

I've noticed Earth radius is different between the implementations so I guess this is the why

6371008.8

6378137

I see JS nearly changed to the same value for earth's radius but got reverted.

Is there a reason the port doesn't produce the same result as the original?

ac87 avatar Aug 14 '20 12:08 ac87

Related: mapbox/turf-swift#26.

1ec5 avatar Aug 25 '20 19:08 1ec5