[Loadstone] Crossing the international date line
shawn at odyssey.cm.nu
Thu Aug 23 22:52:52 BST 2007
The problem is when you hit one edge or the other during a database select.
Then the database thinks you're accross the earth. Fixing this would require
a lot of database select code and would most likely slow things down quite a
Your script is interesting but wouldn't be exactly right. The problem is the
earth isn't exactly round so the distance calculator has to take that in to
account. If you want to see how loadstone does it then look at gps.cpp in
the source. Bonus points if anyone can actually figure out how that works.
On Thu, 23 Aug 2007, Hasan Karahasan wrote:
> Sorry to come up again with this. We have discussed it a fiew months ago.
> Shawn said that the date line currently cannot be crossed, because ls thinks
> that you are on the other side of the earth.
> When I do distance calculations in a little perl script, it works fine even
> accross the date line boundary. So what is loadstone's exact problem? Or is
> it me doing something wrong?
> # calculates the distances between two geographical points on earth
> # coordinates must be given at the command line as lat1 lon1 lat2 lon2
> use strict;
> use Math::Trig;
> my $r = 6378.137; # equator radius
> my $distance;
> # we must first translate all degree values into rad values for the
> trigonometric functions
> my $lat1 = deg2rad($ARGV);
> my $lon1 = deg2rad($ARGV);
> my $lat2 = deg2rad($ARGV);
> my $lon2 = deg2rad($ARGV);
> # distance formular
> $distance = acos(sin($lat1)*sin($lat2) +
> cos($lat1)*cos($lat2)*cos($lon2-$lon1)) * $r;
> print $distanz . "\n";
> Loadstone mailing list
> Loadstone at loadstone-gps.com
More information about the Loadstone