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

large distance errors appearing in the short-range case by Andoyer and Thomas formulas #1217

Open
kkdd opened this issue Dec 3, 2023 · 7 comments

Comments

@kkdd
Copy link

kkdd commented Dec 3, 2023

Hello,
The Boost Geometry's distance calculations by Andoyer and Thomas formulas seem to induce large errors in the short-range case, as shown in
Figure 1. The maximum absolute distance error as a function of distance. in GEODESIC ALGORITHMS: AN EXPERIMENTAL STUDY by Vissarion Fisikopoulos (2019).

I think they should use law of haversines formula for distance (i.e., d = 2 * asin(sin_d_half)) for accuracy, instead of spherical law of cosines (i.e., d = acos(cos_d)).
Thank you.

@kkdd
Copy link
Author

kkdd commented Dec 3, 2023

Hello,
I will add data set for testing accuracy by using GeodSolve:

#!/bin/sh
step=1  # in degree
dist_max=19970000  # in meter

for dist_exponent in $(seq 0 7); do
for dist_significand in 1 3; do
  dist=$((10 ** dist_exponent * dist_significand))
  [ $dist -gt $dist_max ] && dist=$dist_max
  for dir in $(seq 0 $step 90); do
    for lat in $(seq -90 $step 90); do
      echo $lat 0 $dir $dist | sh -c 'w="$(cat)"; /bin/echo -n "$w "; GeodSolve -p 9 --input-string "$w"' | awk '{print $1,$2,$3,$5,$6,$7,$4}'
    done
  done
done
done

The following is an accuracy test using haversine (and above data set):
geodistance

The following compares Andoyer formula using haversine with that using cosine law:
cosine_law

@tinko92
Copy link
Contributor

tinko92 commented Dec 3, 2023

If I understand that paper right, it includes the haversine formula in the comparison under the label "spherical" and it produces orders of magnitude larger errors for every maximum distance except 2 meters.

@kkdd kkdd mentioned this issue Dec 4, 2023
@vissarion
Copy link
Member

Thanks for opening this issue and for the computations. Indeed, it seems a good idea to replace d = acos(cos_d)) by 2 * asin(sin_d_half)) in andoyer and thomas formulas.

@kkdd
Copy link
Author

kkdd commented Dec 5, 2023

I missed the calculation for Andoyer formula in above chart. I calculated, instead, the result of Andoyer-Lambert one, which uses parametric latitude.

@vissarion
Copy link
Member

I missed the calculation for Andoyer formula in above chart. I calculated, instead, the result of Andoyer-Lambert one, which uses parametric latitude.

Could you please provide the details of how you generated the plots above. I thought you were using the boost geometry's formulas.

@kkdd
Copy link
Author

kkdd commented Dec 5, 2023

I'm using the equivalents of the boost geometry's formulas for the plots above.
I'm now struggling against my disordered status about these, however.
So please be patient for a while. Thank you.

@kkdd
Copy link
Author

kkdd commented Dec 8, 2023

I've just updated https://github.com/kkdd/geodistance-js for providing the benchmarks and plots of formulas. Its minimum deployment is provided in https://kkdd.github.io/geodistance-js:

andoyer

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

No branches or pull requests

3 participants