I've been playing with this source for several days and have mixed results to show for it.

Using Geo::Ellipsoid Initial location is 50.754444 6.020833 New location is 50.7496017030457 7.08357125653985 diff is 1.06273825653985 sanity check for earth assuming a sphere ratio is 111.319444444444 km/degree distance is 118.303432307874 dist is 74.9999999999233 $ cat 2.geo.pl #!/usr/bin/env perl use 5.011; use warnings; use Geo::Ellipsoid; print "\nUsing Geo::Ellipsoid\n"; my $gel = Geo::Ellipsoid->new( ellipsoid => 'WGS84', #default value units => 'degrees', distance_units => 'kilometer', longitude => 6.020833, bearing => 0, ); my @ini_lat_lon1 = ( 50.754444, 6.020833 ); say "Initial location is @ini_lat_lon1"; my ( $x, $y ) = ( 75, 0 ); my @new_lat_lon = $gel->location( @ini_lat_lon1, $x, $y ); say "New location is @new_lat_lon"; my $diff = $new_lat_lon[1] - $ini_lat_lon1[1]; say "diff is $diff"; say "sanity check for earth assuming a sphere"; my $circum = 40075; #km my $circle = 360; #degrees my $ratio = $circum / $circle; say "ratio is $ratio km/degree"; my $distance = $diff * $ratio; say "distance is $distance"; ## trying another method # my $dist = $geo->range( @origin, @destination ); my $dist = $gel->range( @ini_lat_lon1, @new_lat_lon ); say "dist is $dist"; __END__ $

My sanity check fails. The documentation warns of non-Euclidean effects: the cpan listing

NOTE: The x and y displacements are only approximations and only valid between two locations that are fairly near to each other. Beyond 10 kilometers or more, the concept of X and Y on a curved surface loses its meaning.

Also, for those who want to replicate these things, it does take a lot of time for dependencies to be satisfied. I like to know that I have it all ready to go for when I get stranded on an island in the Pacific.


In reply to Re^2: Determine lat/lon of geo location at given distance from other location by Aldebaran
in thread Determine lat/lon of geo location at given distance from other location by Anonymous Monk

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.