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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |