Distance between two uncertain points using haversine?

  • #1
Frank Einstein
163
1
TL;DR Summary
I have two points which represent geographical positions whose coordinates are given in spherical coordinates and also have an associated uncertainty. I can calculate the distance between said points in cartesian coordinates, but I don't know how to translate the uncertainty.
Hello everyone.

I have two points in space (on the surface of the earth) represented using spherical coordinates (in this case there is no z axis since both are assumed to be at the same height). These points have an associated standard deviation in lambda and in phi, which are longitude and latitude respectively. I can calculate the distance between the mean position of both points using the haversine as


ζ=sin^2[(φ1-φ2)/2]+cos(φ1)cos(φ2)sin^2[(λ1-λ2)/2] and then


d=2*R*atan2(√ζ, √1-ζ) where R is the Earth radius and d is the distance in meters between the points defined by (λi,φi) where i=1,2.

However, I have no idea on how to find out the uncertainty of d. I have a standard deviation for the values of (λi,φi), I was wondering if someone can tell me how to incorporate this data to the haversine to be able to calculate the standard deviation of the distance d.

Can someone please tell me of a way to do this?

Any help is appreciated.
Regards.
Frank.
 

Answers and Replies

  • #2
fresh_42
Mentor
Insights Author
2022 Award
17,796
18,969
What do you mean by uncertainty? If e.g. you have a circle of uncertainty around each point, then uncertainty of distance is plus, minus twice the radius of said circle.
 
  • #3
Frank Einstein
163
1
What do you mean by uncertainty? If e.g. you have a circle of uncertainty around each point, then uncertainty of distance is plus, minus twice the radius of said circle.
Thanks for the answer. I want to calculate the standard deviation of the variable d knowing the standard deviations of φ1, φ2, λ1 and λ2
 
  • #4
fresh_42
Mentor
Insights Author
2022 Award
17,796
18,969
So you have the random variable ##X=d(\varphi_1,\varphi_2,\lambda_1,\lambda_2 )## where the variables themselves are random variables, and the function is composed of many trigonometric functions. I don't think there is a reasonable closed form for this problem. So you can try to use the Taylor series for the trigonometric functions, which still will leave you with a complicated integral, or you abbreviate this step by the formula given in
https://en.wikipedia.org/wiki/Variance#Approximating_the_variance_of_a_function
or you use one of the formulas in here:
https://en.wikipedia.org/wiki/Distance_correlation

I think it is already difficult to calculate the mean value for the normal distribution function, which I assume is relevant here.
 
  • Like
Likes DaveE and Frank Einstein
  • #5
hutchphd
Science Advisor
Homework Helper
2022 Award
5,514
4,699
I think it is already difficult to calculate the mean value for the normal distribution function, which I assume is relevant here.

I don't see the difficulty here . This is standard propagation of error for nonlinear system. You just use the partial derivative.

https://en.wikipedia.org/wiki/Propagation_of_uncertainty

Am I missing something?
 
  • Like
Likes DaveE and fresh_42
  • #6
Frank Einstein
163
1
So you have the random variable ##X=d(\varphi_1,\varphi_2,\lambda_1,\lambda_2 )## where the variables themselves are random variables, and the function is composed of many trigonometric functions. I don't think there is a reasonable closed form for this problem. So you can try to use the Taylor series for the trigonometric functions, which still will leave you with a complicated integral, or you abbreviate this step by the formula given in
https://en.wikipedia.org/wiki/Variance#Approximating_the_variance_of_a_function
or you use one of the formulas in here:
https://en.wikipedia.org/wiki/Distance_correlation

I think it is already difficult to calculate the mean value for the normal distribution function, which I assume is relevant here.
Thanks again for the answer. That's what I feared, no closed loop form. I don't know if this is relevant, but I am working in Matlab, where I have calculated the aforementioned quantities as

Distance calculation:
haversine_angle=(sin((phiMeanA-phiMeanB)/2)).^2+cos(lammdaMeanA).*cos(lammdaMeanB).*(sin((lammdaMeanA-lammdaMeanB)/2)).^2;
haversine_sqrt=(haversine_angle).^0.5;
haversine_sqrt2=1.-haversine_sqrt;


haversine_mean_distance =RT.*atan2(haversine_sqrt, haversine_sqrt2);
and the standard deviations are in different variables. The values of the standard deviations are

phiStdA=6.608673643811970e-08

phiStdB=7.548195779015499e-08

lambdaStdA= 7.757704741906700e-09

lambdaStdB=9.494186140546169e-09

and the values of the position of the mean of both points is

phiMeanA=0.879103498447014

phiMeanB=0.856643114991405

lammdaMeanA=0.007900824598177

lammdaMeanB=0.007461768949733

haversine_mean_distance=7.244901394376239e+04

RT=6378000
 
  • #7
Frank Einstein
163
1
I don't see the difficulty here . This is standard propagation of error for nonlinear system. You just use the partial derivative.

https://en.wikipedia.org/wiki/Propagation_of_uncertainty

Am I missing something?
Probably I am the one missing something here. I don't know how to implement what you are providing since I only have numerical values as you can see in my previous message
 
  • #10
hutchphd
Science Advisor
Homework Helper
2022 Award
5,514
4,699
Did you read the other page about errors propagation?


1612036873018.png
 
  • Like
Likes Frank Einstein
  • #11
Frank Einstein
163
1
Did you read the other page about errors propagation?


View attachment 277152
So, if I understand you correctly, I have to manually derivate atan2(√ζ, √1-ζ) respect to φ and then respect to λ and then substitute the values in the point as
phiStdA=6.608673643811970e-08

phiStdB=7.548195779015499e-08

lambdaStdA= 7.757704741906700e-09

lambdaStdB=9.494186140546169e-09

and the values of the position of the mean of both points is

phiMeanA=0.879103498447014

phiMeanB=0.856643114991405

lammdaMeanA=0.007900824598177

lammdaMeanB=0.007461768949733

Is this it? I thought that I could not calculate that with at least two points to have a value of the derivative. I don't know what I was thinking.

Thanks.
Regards.
Frank.

Please, confirm me that I have the right idea.
 
  • #12
hutchphd
Science Advisor
Homework Helper
2022 Award
5,514
4,699
Yes you have to take the relevant derivatives and put in the numbers. I will leave the details to you for now. Give it a try.
 
  • Like
Likes Frank Einstein
  • #13
Frank Einstein
163
1
Yes you have to take the relevant derivatives and put in the numbers. I will leave the details to you for now. Give it a try.
Thanks.
 

Suggested for: Distance between two uncertain points using haversine?

Replies
4
Views
1K
Replies
1
Views
1K
Replies
8
Views
799
Replies
3
Views
415
  • Last Post
Replies
2
Views
1K
  • Last Post
Replies
5
Views
962
Replies
12
Views
157
  • Last Post
Replies
9
Views
971
Top