geometry icon indicating copy to clipboard operation
geometry copied to clipboard

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

Open kkdd opened this issue 1 year ago • 7 comments
trafficstars

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 avatar Dec 03 '23 04:12 kkdd

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

kkdd avatar Dec 03 '23 10:12 kkdd

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.

tinko92 avatar Dec 03 '23 12:12 tinko92

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.

vissarion avatar Dec 04 '23 10:12 vissarion

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

kkdd avatar Dec 05 '23 09:12 kkdd

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.

vissarion avatar Dec 05 '23 10:12 vissarion

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 avatar Dec 05 '23 14:12 kkdd

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

kkdd avatar Dec 08 '23 07:12 kkdd