No subject

Ralph DiMola rdimola at
Fri Apr 3 17:27:26 EDT 2020


This my distance calculation for what it's worth.

Function distance lat1, lon1, lat2, lon2, unit
   -- Calculate Distance between to points
   --lat1, lon1, lat2, lon2 are in deg.fractionalDegrees
   -- Unit
   --     if empty then miles
   --     K = kilometers
   --     N = nautical miles
   local theta
   local dist
   Put lon1 - lon2 into theta
   put Sin(deg2rad(lat1)) * Sin(deg2rad(lat2)) + Cos(deg2rad(lat1)) * Cos(deg2rad(lat2)) * Cos(deg2rad(theta)) into dist
   put Acos(dist) into dist
   put rad2deg(dist) into dist
   put dist * 60 * 1.1515 into dist
   switch unit
      case "K"
         put dist * 1.609344 into dist
      case "N"
         put dist * 0.8684 into dist
   end switch
   Return dist

End distance

Function rad2deg rad
   Return rad / PI * 180.0
end rad2deg

Ralph DiMola
IT Director
Evergreen Information Services
rdimola at

-----Original Message-----
From: use-livecode [mailto:use-livecode-bounces at] On Behalf Of Graham Samuel via use-livecode
Sent: Friday, April 03, 2020 3:49 PM
To: How to use LiveCode
Cc: Graham Samuel
Subject: Re: Getting started with geographical coordinates

This is cheeky but I can’t run up my mobile simulation today - can someone tell me the format of the geographical coordinates produced by mobileSensorReading et al. I mean, is say latitude just one integer showing seconds, or is it deg, min, sec - and are fractional seconds returned (so, floating point)? I shall find out for myself eventually but it would help a little to know now. AFAIKS there’s nothing in the LC documentation about it.


use-livecode mailing list
use-livecode at
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:

More information about the use-livecode mailing list