# PhysicsClosing speeds for airplanes

#### catmitt98

##### New member
I am trying to calculate closing speeds for airplane traffic. I am using the formula found here--

https://mathhelpboards.com/calculus-10/calculate-closing-velocities-19402.html

The question I have is about whether or not I can use wgs-84 coordinates for x and y positions for the planes. Basically, I am given a bearing for each plane in degrees, a velocity for each plane in knots, and the wgs-84 latitude/longitude positions, recorded in radians.

I know I can find the x and y velocities by using xvel = sin(bearing(PI/180))*velocity and yvel = cos(bearing(PI/180))*velocity but I'm not sure how to get an x and y position in correct units from latitude/longitude given in radians. I'd need some way to convert radians to nautical miles so that I'd have position in nautical miles, and velocity in nautical miles/hour (knots), but is this possible?

Right now I am converting the radians to degrees, degrees to semi-circle, semi-circle to meters, and meters to nautical miles. (complicated, I know).

When calculating an absolute distance between the two planes, this conversion seems to be accurate. But, when trying to find the x and y values using the latitude and longitude, the x values (longitude * conversion) are too large, and the y values (latitude * conversion) are too small. For example, the straight line distance between the plane circled in blue and the plane circled in red is being calculated as 5.81 nautical miles, which looks accurate. But, x and y positions of the traffic circled in red are being calculated as (+7.4nm, -0.23nm) relative to the one circled in blue, when it should clearly be closer to (+5.9, -2.3). This is causing the closure rate being calculated as positive 43 knots, when in reality it should be negative, as the traffic circled in red is moving 136 knots, and the traffic circled in blue is moving 230 knots.

Is there any reliable way to turn latitude/longitude positions given in radians into nautical miles?

I can post the code I have if needed, but the code is executing the math correctly. It just seems that the conversion from longtitude/latitude in radians to nautical miles is incorrect :/

**As a side note, the definition for semi-circle units can be found here: https://docs.microsoft.com/en-us/previous-versions/windows/embedded/cc510650(v=msdn.10)

#### Klaas van Aarsen

##### MHB Seeker
Staff member
Hi catmitt98,

Historically, a nautical mile was defined as one minute (1/60 of a degree) of latitude along any line of longitude.

So we can calculate the distance to the equator as $(\text{latitude in degrees})\times 60\text{ nm}$.
The distance to the prime meridian along a circle of constant latitude is a bit more complicated, since that distance is along a circle with a smaller radius depending on latitude.
We can find this distance to the prime meridian with $(\text{longitude in degrees})\times 60\times\cos(\text{latitude})$.

These are not X and Y coordinates though.
You refer to the WGS84 standard. It has indeed X and Y coordinates -- but also a Z coordinate.
And it is with respect to the center of the earth.

So if you use it to convert latitude and longitude to cartesian coordinates, you also need to take the Z coordinate into account.
Those X, Y, and Z coordinates can be used in the formulas you mentioned.
And it does not matter if they are meters or nautical miles, as long as you are consistent.

#### catmitt98

##### New member
So if I have 2 sets of coordinates like 38°51'23.3"N 94°44'14.4"W, and 38°50'19.7"N 94°50'06.7"W, is there a reliable way to get the distance between them, and to find the x and y portions of that distance? I know the earth is curved so any calculations trying to get distances that assume a flat surface are going to have a margin of error, but at what distance does that margin of error become large enough to be noticeable?

Really I just need a way to get an x and y position for planes that I can use in the closing speed calculations. I thought the latitude and longitude of each would be good, but I suppose the earth being a sphere throws that off a bit.

#### Klaas van Aarsen

##### MHB Seeker
Staff member
So if I have 2 sets of coordinates like 38°51'23.3"N 94°44'14.4"W, and 38°50'19.7"N 94°50'06.7"W, is there a reliable way to get the distance between them, and to find the x and y portions of that distance? I know the earth is curved so any calculations trying to get distances that assume a flat surface are going to have a margin of error, but at what distance does that margin of error become large enough to be noticeable?

Really I just need a way to get an x and y position for planes that I can use in the closing speed calculations. I thought the latitude and longitude of each would be good, but I suppose the earth being a sphere throws that off a bit.
Include the z position.
For now we can assume a height of the plane of 0 meters.
That is, find the position of each plane with respect to the center of the earth.
Then we can calculate the distance between them normally, based on (x,y,z) vectors.

I found an online converter here:
APSalin - Free Online Tools - Geodetic To Cartesian Convertor

Fill in latitude [M]38 51 23.3 N[/M], longitude [M]94 44 14.4 W[/M], and height [M]0[/M].
Click Convert.

You'll get the Cartesian (X, Y, Z) coordinates. In this case in meters.

Do the same thing for the other set of coordinates.

Now we can calculate their distance to each other.
This is the real distance and not an approximation.
That is, the only approximation is that we use the WGS 84 model of the earth.
And to be fair, it is the distance along a straight line. Not the distance along the curve of the earth.