John,

> On Apr 12, 2020, at 10:33 AM, John J Foster via 4D_Tech 
> <[email protected]> wrote:
> 
> If you happen to find any 4D bearing/distance code (anything related to 
> searching using longitude/latitude or both) I would enjoy looking at it.

I had worked out these calculations with a mathematician called C. E. Tiedemann 
many years ago.  Here is an except from our emails, entitled 'Ellipsoid Radius 
Calculation’.


Now I see what's going on.  The figures in the table are merdianally
oriented radii of hypothetical spheres for which the surface curvature
matches the (a, b, e) ellipsoid at the specified latitude.  Knowing these
allows use of fairly simple spherical formulae for computing distances
between points not too far apart on surfaces of ellipsoids.

- - - -

OK, I took a look at the URL and found my comment just below the material
we're looking at.  In fact I remember having made those observations, but
it was a LONG time ago and at the momen I've no recollection of the context
in which they were made.

But, all may not be lost:  bouncing up a way in the text I found the following:

R' = a * (1 - e^2) / (1 - e^2 * (sin(lat))^2)^(3/2)

The additional "^(3/2) will have the effect of increasing the denominator
and maybe bring things into agreement with your/our expectations.


This is the routine we came up with, which seems to work well.


  // CalcDistance  11/24/02
  //
C_REAL($0;$1;$2;$3;$4;$Lat1;$Long1;$Lat2;$Long2;$DegToRad;$Work;$Distance)  // 
11/24/02
  //
$Lat1:=$1  // 11/23/02
$Long1:=$2  // 11/23/02
$Lat2:=$3  // 11/23/02
$Long2:=$4  // 11/23/02
  //
$DegToRad:=57.29577951308  // 11/23/02
  //
$Work:=(Sin($Lat1/$DegToRad)*Sin($Lat2/$DegToRad))+(Cos($Lat1/$DegToRad)*Cos($Lat2/$DegToRad))*Cos(($Long2/$DegToRad)-($Long1/$DegToRad))
  // 11/23/02
$Distance:=3958.75*Arctan(Square root(1-($Work^2))/$Work)  // 11/23/02
  //
$0:=$Distance  // 11/23/02


Feel free to use this if it’s of help to you.


Randy Kaempen
Intellex Corporation

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to