Geographic Functions, any takers?
ewan at supremis.co.uk
Mon Aug 30 18:21:20 CDT 2010
Thanks for your reply. Any resources would be greatly appreciated, I can see
an SQL database of locations being very useful. Have already set up a
database of UK lat - longs & towns, postcodes ect, so would be useful to
extend this. If theres enough interest id be happy to allow access to the
database, or a copy for anyone interested.
Spooky that you mention the Haversine formula. Was just prototyping that as
your email bounced in.
function CalculateRiemannDistance thedata
set the itemdelimiter to comma
put item 1 of thedata into lat_from
put item 2 of thedata into long_from
put item 3 of thedata into lat_to
put item 4 of thedata into long_to
put item 5 of thedata into unit
case "m" -- unit is miles
put 3963 into unit
case "n" --unit is nautical miles
put 3444 into unit
put 6371 into unit
/*** 1 degree = 0.017453292519943 radius ***/
put converttoRadians(lat_from) into lat_from
put converttoRadians(long_from) into long_from
put converttoRadians(lat_to) into lat_to
put converttoRadians(long_to) into long_to
/*** apply the Great Circle Distance Formula ***/
put sin($lat_from) * sin($lat_to) + cos($lat_from) * cos($lat_to) *
cos($long_from - $long_to) into dist
The world is indeed getting smaller!
From: use-revolution-bounces at lists.runrev.com
[mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of Francis Nugent
Sent: 30 August 2010 22:28
To: use-revolution at lists.runrev.com
Subject: Geographic Functions, any takers?
Hi from Beautiful Brittany.
Ewan wrote :
> Compute true course and distance between points.
I don't know if I have something which may solve part of your problems.
I travelled a lot, before retiring, and always kept a note of cities
visited, and stopovers on the way. I decided, one day to feed all of my data
into a TRAVEL stack, to see how far I had really travelled (finally, more
than 2 million klicks).
I picked uf a file on the internet with position co-ordinates of 10,000
cities in the world, and than converted these co-ordinates to Lat/Long in
radians. Then with a Haversine formula, I can calculate the distance
between any two cities in the world (in km.), with up to 6 stopovers.
example : Paris-Lisbon-Rio-London-Paris.
You can, of course, feed in co-ordinates of any point on the globe, of any
small town not in the list of 10,000 !
If my calculations are of use, just shout !.
"Nothing should ever be done for the first time !"
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
More information about the use-livecode