Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

latitude and loggitude to distance?

Status
Not open for further replies.

asic1984

Full Member level 5
Full Member level 5
Joined
Nov 15, 2003
Messages
257
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,298
Activity points
2,340
hi all

how can i calculate the distance giving the latitude and longitude of a point with a reference point

thanks for help
 

Heard about geodesics? The two points on any surface can be connected by a geodesics. For example, if the surface happens to be a plan, the geodesics will be a straight line connecting the two points. Then the lenghth of the segment of the curve will be the distance.
Usually, for any surface, getting the geodesics amounts to solve a bunch of ODE's, which sounds like a daunting job. Fortunately, it's pretty simple to get geodesics on a sphere, which are called "grand circles". Furthermore, for any two points on the sphere of radius r, the distance can be obtained by integrating

ds^2=r^2 * (dtheta^2 + (sin(theta))^2 * dphi^2)

where (t, phi, theta) is the sphere coordinate.
So, here is what you should. First, choose your sphere coordinate system and then transform the latitudes and the longitudes to sphere coordinates. The second step is to construct a relationship between theta and phi. Notice that if your sphere system is chosen properly, this relation could be as simple as an equation for a straight line. The last step to integrate the differential relation above, which essentially is just calculating the length of a piece of arc.
 

You are looking for the "great circle distance."

**broken link removed**

has the equation and a discussion.

If you want to do some math on your own, remember that this is a spherical problem and you can represent the points in vector notation. Then get the angle between them, convert the angle to radians and multiply by the earth's radius.
 

Oh, boy, those we have done may be overkills. Here might be a better and simple way to resolve the specific issue (only works for sphere). Latitude and Longitude are essentially sphere coordinates (except a possible shift for latitude). From them you can get the cartesian coordinates. Assume that the (cartesian) coordinates of the two points are p1=(x1,y1,z1) and p2=(x2,y2,z2). Then the inner product of the two vectors shows
cos(angle)=p1*p2/(|p1|*|p2|)
Therefore, angle=acos(p1*p2/(|p1|*|p2|)). Thus the distance=angle*r, where r is the radius of the earth.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top