Perl-Sensitive Sunglasses PerlMonks

### Re: How do I compute the longitude and latitude of a point at a certain distance?

by I0 (Priest)
 on Apr 22, 2003 at 08:37 UTC ( #252219=note: print w/replies, xml ) Need Help??

```(\$latitude,\$longitude)=ll(
MILES=>5,
LATITUDE=>51+29/60,
LONGITUDE=>0+0/60,
DIRECTION=>315,
);

if( \$latitude < 0 ){
\$latitude *= -1;
\$ns='S';
}else{
\$ns='N';
}
if( \$longitude < 0 ){
\$longitude *= -1;
\$ew='W';
}else{
\$ew='E';
}
print int \$latitude,"°",60*(\$latitude-int \$latitude),"' \$ns\n",
int \$longitude,"°",60*(\$longitude-int \$longitude),"' \$ew\n";
use Math::Trig;
sub ll{
my %l=@_;
use constant PI=>4*atan2(1,1);
my \$nm = \$l{MILES}*.87;
my \$A=\$l{DIRECTION}*PI/180;
my \$b=(90-\$l{LATITUDE})*PI/180;
my \$c=\$nm/60/180*PI;
my \$a=acos(cos(\$b)*cos(\$c)+sin(\$b)*sin(\$c)*cos(\$A));
my \$latitude=90-180/PI*\$a;
my \$C=asin(sin(\$c)*sin(\$A)/sin(\$a));
my \$longitude=\$l{LONGITUDE}+180/PI*\$C;
return \$latitude,\$longitude;
}
• Comment on Re: How do I compute the longitude and latitude of a point at a certain distance?

Create A New User
Node Status?
node history
Node Type: note [id://252219]
help
Chatterbox?
 [Corion]: We-ird - I hadn't known this, but Ingress and Pokemon Go (both AR games in the real world where you run around) switched from using Google Maps to OpenStreetMaps, which is great. But I wonder why, as Ingress is (was?) owned by Google/Alphabet. But ... [Corion]: ... maybe not wholly owned, or the load on Google Maps was too high?!

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2018-03-19 09:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
When I think of a mole I think of:

Results (236 votes). Check out past polls.

Notices?