[Loadstone] Crossing the international date line

Hasan Karahasan karahasan at onlinehome.de
Thu Aug 23 21:31:01 BST 2007


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?

#!/bin/perl
# 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[0]);
my $lon1 = deg2rad($ARGV[1]);
my $lat2 = deg2rad($ARGV[2]);
my $lon2 = deg2rad($ARGV[3]);
# distance formular
$distance = acos(sin($lat1)*sin($lat2) + 
cos($lat1)*cos($lat2)*cos($lon2-$lon1)) * $r;
print $distanz . "\n";



More information about the Loadstone mailing list