Distance between two GPS points.
-
hai all, is it possible to find the distance in meters between the two points if i have, their longitude, latitude and height. iam aware that, the distance between two adjacent graticules is not standatd in all the places on the earth. but, based on the height, can we do any thing? thanks for your views.
Are you talking points that are close, or anywhere on Earth; that is, are you wanting to take into account the curvature of the Earth? Another question: Are you talking about the great-circle distance (around the curvature of the Earth), or a straight line (which would have to tunnel thru the Earth if distances are very far)? David
-
we can do this, but iam not sure weather this applies through out the globe. any way, thanks for your response.
-
Are you talking points that are close, or anywhere on Earth; that is, are you wanting to take into account the curvature of the Earth? Another question: Are you talking about the great-circle distance (around the curvature of the Earth), or a straight line (which would have to tunnel thru the Earth if distances are very far)? David
-
Ha has a neutrino gun! :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
CPallini wrote:
Ha has a neutrino gun!
dagnabbit! I want one!!!! :-D
_________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
-
hai all, is it possible to find the distance in meters between the two points if i have, their longitude, latitude and height. iam aware that, the distance between two adjacent graticules is not standatd in all the places on the earth. but, based on the height, can we do any thing? thanks for your views.
chandu004 wrote:
is it possible to find the distance in meters between the two points if i have, their longitude, latitude and height.
The short answer: Yes. The long answer: you need to deal with great-circle (geodesic solution) calculations. See: http://mathworld.wolfram.com/GreatCircle.html[^] There is also an iterative solution that is often used for boat/air travel. Obviously continuously changing your heading to provide the absolute shortest route to the meter is difficult. So you create waypoints travel to them, change heading and travel to the next, etc., until you reach your destination. This has become easier with computers because a computer auto-pilot will auto-navigate to many more waypoints with micro changes in heading to keep a shorter path. But with ocean travel that is somewhat more difficult. The question becomes how accurate do you need it, and what is the purpose of the answer. The piece-wise iterative approach would be:
surfacedistance(from: lat, lon, alt; to: lat, long, alt) { distance= ECEFdistance(ecef(to),ecef(from)); // choose your desired approximation level for accuracy if (distance<1000) return distance; // else recurse and use piecewise approximation ecef_mid=ecef_to*0.5+ecef_from*0.5; spher_mid=togeodetic(ecef_mid); spher_mid.alt=from.alt*0.5+to.alt*0.5; return surfacedistance(from,spher_mid)+surfacedistance(spher_mid,to); }
or something similar (that is off the top of my head, google piecewise approximation of geodesic distances. The idea is that you can sum a series of vector distances in local space and the more accurate your division, the more accurate the answer. You can choose speed over accuracy at any point by changing the approximation distance change between mid-point division and vector-distance. The bad news is, if you set the value too low, it is a heavy recursion level and you are better off calculating it directly. There are times in implimentation you may want to do either for other reasons related to use of the answer._________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
-
hai all, is it possible to find the distance in meters between the two points if i have, their longitude, latitude and height. iam aware that, the distance between two adjacent graticules is not standatd in all the places on the earth. but, based on the height, can we do any thing? thanks for your views.
chandu004 wrote:
is it possible to find the distance in meters between the two points if i have, their longitude, latitude and height.
Like these: http://mathforum.org/library/drmath/view/51720.html http://jan.ucc.nau.edu/~cvm/latlongdist.html http://mathforum.org/library/drmath/view/51711.html http://www.movable-type.co.uk/scripts/latlong-vincenty.html http://mathforum.org/library/drmath/view/54680.html http://www.freevbcode.com/ShowCode.asp?ID=5532 http://mathforum.org/library/drmath/view/51717.html http://www.meridianworlddata.com/Distance-Calculation.asp http://mathforum.org/library/drmath/view/51722.html http://www.csgnetwork.com/longlatdistance.html http://mathforum.org/library/drmath/view/54941.html http://www.csgnetwork.com/lldistcalc.html http://mathforum.org/library/drmath/view/54680.html
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
chandu004 wrote:
is it possible to find the distance in meters between the two points if i have, their longitude, latitude and height.
Like these: http://mathforum.org/library/drmath/view/51720.html http://jan.ucc.nau.edu/~cvm/latlongdist.html http://mathforum.org/library/drmath/view/51711.html http://www.movable-type.co.uk/scripts/latlong-vincenty.html http://mathforum.org/library/drmath/view/54680.html http://www.freevbcode.com/ShowCode.asp?ID=5532 http://mathforum.org/library/drmath/view/51717.html http://www.meridianworlddata.com/Distance-Calculation.asp http://mathforum.org/library/drmath/view/51722.html http://www.csgnetwork.com/longlatdistance.html http://mathforum.org/library/drmath/view/54941.html http://www.csgnetwork.com/lldistcalc.html http://mathforum.org/library/drmath/view/54680.html
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
hai all, is it possible to find the distance in meters between the two points if i have, their longitude, latitude and height. iam aware that, the distance between two adjacent graticules is not standatd in all the places on the earth. but, based on the height, can we do any thing? thanks for your views.
You probably know that the "standard distance" for 1 nautical mile is 6076.115 feet. And that 1 degree of latitude is 60 Nautical miles (NM). There is no "standard" for longitude since it is wider at the equator and they all conjoin at the poles to zero distance. I think there is a formula for determining the length of 1 degree of longitude based on the latitude where the longitude is taken, but don't know it offhand. If you are somewhere in the range of 30 to 60 degrees latitude, the "standard distance" formula will get you close to the correct distance between two points.
John P.
-
thanks a lot david, one of the above links helped me to understand many interesting points. and the logic worked for some of hte examples, so far i have tested.
chandu004 wrote:
and the logic worked for some of hte examples, so far i have tested.
the logic should work quite well. I haven't gone through most of the links, but I checked a few of them. I am not sure what you need the answer for, but it would be wise to clarify that your answer is for a spherical Earth not an ellipsoidal model. At least the ones I followed so far assume a spherical earth. This is a decent approximation, but again, it depends on what you are trying to do. No answer will be exactly right because even an ellipsoidal model is an approximate surface. The true surface is mapped in elevation points to the geoid.
_________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
-
hai all, is it possible to find the distance in meters between the two points if i have, their longitude, latitude and height. iam aware that, the distance between two adjacent graticules is not standatd in all the places on the earth. but, based on the height, can we do any thing? thanks for your views.
the easiest way to do it (assuming spherical earth)is to convert the lat-lon values into X-Y-Z values. The center of the earth is (0,0,0), the intersection of the prime meridian and the equator is (R,0,0) lat 0, lon +90 is (0,R,0), the north pole is (0,0,R) the south pole is (0,0,-R) where R = radius of earth to go from lat lon to x y z is: x = R * Cos(lon) * Cos(lat) y = R * Sin(Lon) * Cos(lat) z = R * Sin(lat) You do that for point 1 and point 2, then determine the distance between them (straight line) x' = x2-x1 y' = y2-y1 z' = z2-z1 d = sqrt((x'*x')+(y'*y')+(z'*z')) One half of the angle from point 1 to point 2 is a = ArcSin(d/2R) to get the great circle distance take this angle (in radians), double it to get the actual angle, them multiply if by the radius of the earth D = 2 * a * R where D is the distance you are looking for.