Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( [id://3333]=superdoc: 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; }

In reply to Re: How do I compute the longitude and latitude of a point at a certain distance? by I0
in thread How do I compute the longitude and latitude of a point at a certain distance? by themaetrix

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-04-19 22:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found