Let's begin with a definition of the latitude and longitude
coordinates mentioned in your question.
[Latitude and Longitude]
Latitude refers to an angle of "elevation" above (or below) the plane
of the equator (as viewed from the Earth's center). Circles of
constant latitude may then be considered intersections between the
earth's surface and planes running perpendicular to the North/South
axis. Where navigators refer to so many degrees of North or South
latitude, ranging from 0 degrees at the equator to 90 degrees at the
poles, it will be convenient for us to consider the degrees North
latitude as "positive" and degrees South latitude as "negative". We
will come to the mathematical reason for this shortly.
Longitude refers to an angle of East/West rotation on the globe,
Prime Meridian (passing through Greenwich) as the origin or:
0 degrees East = 0 degrees West.
Every point on the globe, were it perfectly spherical, would then lie
on a great semicircle drawn from the South Pole to the North Pole, and
the angle of separation between that great semicircle and that of the
Prime Meridian concretely defines the longitude of that point.
Now the Prime Meridian, if continued to form a great circle all the
way around the world, passes largely through the Pacific Ocean, a bit
further West than Hawaii. That "complementary" great semicircle to
the Prime Meridian is roughly where the International Date Line is
drawn (but don't call now, it's already tomorrow there and you'd be
late for any dates you make tonight).
Therefore longitude measurements range from 0 degrees to 180 degrees
either East or West of the Prime Meridian, with the quirk that:
180 degrees East = 180 degrees West
(along the "backside" of the Prime Meridian).
It will turn out to be convenient for us to treat degrees West
longitude as "positive" and degrees East longitude as "negative".
It also turns out that formula (1) given on the Web page above,
converting latitude (phi) and longitude (theta) to Cartesian
coordinates (which make it easy to compute distances, using the
Pythagorean distance formula), is not quite correct. Rather belabor
that point, let me simply give a formula that is correct.
The convention here is that the North/South axis is the z-axis, with
the North Pole on the positive side of the z-axis. Thus the equator
lies in the xy-plane (so that our "sphere" is centered at the origin
in 3D). We pick the positive x-axis to pass through the Prime
Meridian on the equator, and the positive y-axis to pass through 90
degrees West longitude there.
Notice that the z-coordinate should depend only on latitude phi and of
course the radius of the earth.R. In fact, with the convenient
treatment that phi is positive in Northern latitudes and negative in
Southern latitudes, we have simply:
z = R sin( phi )
If one focuses only the equator, where z = 0, then it should be pretty
plausible that the x-coordinate depends on the cosine of the longitude
theta, and that the y-coordinate depends on the sine of the longitude.
Again this takes advantage of our convention that Western longitudes
will be positive and Eastern ones negative. Coupled with the effects
of "shrinking" circles of latitude as we leave the equator and
approach either pole, the following are correct:
x = R cos( phi ) cos( theta )
y = R cos( phi ) sin( theta )
In fact it is easy enough to verify that x^2 + y^2 + z^2 = R^2 for any
latitude and longitude, so that at least we are on the surface of the
sphere of radius R centered at the origin (which is what for
simplicity one imagines the earth to be).
But of course the trick is that R is not constant, first because there
are mountains and valleys (or even ocean depths and space shuttle
flights, if one wants to be particularly colorful) and second because
of the earth's equatorial bulge (no fat jokes, please!). One might
therefore do an even better job of converting spherical coordinates,
represented here by phi and theta, to Cartesian coordinates if R were
allowed to take on a range of values.
A generally adequate value for R is 6,378 km or 3,963 miles:
However that is a value which is mostly accurate for the equatorial
radius. The radius of the earth drops off towards the poles to 6,357
km or 3,950 miles:
[NASA - The Earth, Distance Information]
[Ask a Scientist - Rotating Earth and Latitude]
Bottom line is that the Earth's radius only drops "at sea level" by
about a dozen miles from equator to pole, and if you have an altitude
above (or below) sea level in meters or feet that you'd care to throw
in, you can use the adjusted value of R for any particular location.
Given the latitude and longitude (and perhaps the altitude relative to
sea level), convert those spherical coordinates to Cartesian
coordinates as outlined in the formulas above.
Now if you do this for two locations, you get two points in
three-dimensional space, which we'll denote:
(x1, y1, z1) and (x2, y2, z2)
The distance between them is then:
SQRT( (x1 - x2)^2 + (y1 - y2)^2 + (z1 - z2)^2 )
Of course we want to be careful about units here. Fortunately angles
(whether given in degrees or radians) are what are called
dimension-less numbers; they have no units or "scale" of measurement.
The only units that will enter into the answer are the units from
radius R. You can even use slightly different radius values for the
two locations, just as long as the units are the same. The distance
provided by the square-root formula above will then have the same
units of distance, e.g. in kilometers or miles.
Finally let's consider the "angle of the intersecting line" that you
also ask about. Here it probably only makes sense to consider some
constant value for R, because we need to have a tangent plane to the
"sphere" in order to define the "angle of depression" formed by the
line with the surface. (This tangent plane is perpendicular to the
radius at that point and defines the local "horizontal" plane there.)
Consider that between any two points on the globe there is a segment
of a great circle joining them, subtending an angle of at most 180
degrees (since otherwise we could join the points by a shorter arc
going the "other way" around the great circle).
The straight line whose length we computed before is now a chord on
that great circle, intersecting it at the two points of interest. The
chord forms the base of an isosceles triangle when taken together with
the two radii drawn from the Earth's center to the two locations.
The "angle of depression" between the intersecting line and the
Earth's surface (or to a plane tangent to the sphere at either point)
is then complementary to the base angles of the isosceles triangle
(because the tangent plane is perpendicular to the radius drawn to
that point). A bit of trigonometry can be done, once the isosceles
triangle is bisected into two right triangles.
The result is that if the chord length (shortest distance along
intersecting line) is D, then the angle of depression A is:
A = arccos(0.5*D/R)
Note that this formula predicts that if D = 2R, ie. a line going
straight through the Earth's center (diameter), then the angle of
depression A would be 90 degrees or "straight down".