1.00567724920722457, -0.00344230425560210245, 0.000713971534527667990, -0.0000777240053499279217, 0.00000673180367053244284, -0.000000742595338885741395, 0.0000000905058919926194134 ); my $x; my $y; my $z; my $v; my $h; my $delta; = @_; my $t1 = ($v - $transv) / $radius; my $t2 = ($h - $transh) / $radius; my $vhat = $rotc*$t2 - $rots*$t1; my $hhat = $rots*$t2 + $rotc*$t1; my $e = cos(sqrt($vhat*$vhat + $hhat*$hhat)); my $w = cos(sqrt($vhat*$vhat + ($hhat-0.4)*($hhat-0.4))); my $fx = $ey*$w - $wy*$e; my $fy = $ex*$w - $wx*$e; my $b = $fx*$gx + $fy*$gy; my $c = $fx*$fx + $fy*$fy - $q2; my $disc = $b*$b - $a*$c; #discriminant if ($disc == 0.0) { #It's right on the E-W axis $z = $b/$a; $x = ($gx*$z - $fx)/$q; $y = ($fy - $gy*$z)/$q; } else { $delta = sqrt($disc); $z = ($b + $delta)/$a; $x = ($gx*$z - $fx)/$q; $y = ($fy - $gy*$z)/$q; if ( $vhat * ( $px*$x + $py*$y + $pz*$z) < 0 ) { #wrong direction $z = ($b - $delta)/$a; $x = ($gx*$z - $fx)/$q; $y = ($fy - $gy*$z)/$q; }; }; my $lat=asin($z); #Use polynomial approximation for inverse mapping #(sphere to spheroid) my $lat2 = $lat*$lat; my $earthlat = 0; for (my $i=6; $i>=0 ; $i--) { $earthlat = ($earthlat + $bi[$i]) * ($i? $lat2 : $lat); }; $earthlat *= 180/$m_pi; # Adjust Longitude by 52 degrees my $lon = atan2($x,$y) * 180/$m_pi; my $earthlon = $lon + 52.0000000000000000; return ($earthlat,$earthlon); }; 1; __END__ # Below is stub documentation for your module. You better edit it! =head1 NAME Geo::Coordinates::VandH - Convert and Manipulate telco V and H coordinates =head1 SYNOPSIS To convert V: 5498 H: 2895 to lat/long coordinates: use Geo::Coordinates::VandH; $blah=new Geo::Coordinates::VandH; ($lat,$lon) = $blah->vh2ll(5498,2895); printf "%lf,%lf\n",$lat,$lon; To find the mileage between 5498,2895 and 5527,2873 in miles: use Geo::Coordinates::VandH; $blah=new Geo::Coordinates::VandH; printf "Distance between Pontiac, MI and Southfield, MI is approximately: %d miles\n",$blah->distance(5498,2895,5527,2873); =head1 DESCRIPTION Currently this package supports the translation of V+H to Lat/Long, and mileage calculations between two V+H coordinates. Results are returned in decimal degrees for V+H to Lat/Long, and Miles for distance. Future versions will convert Lat/Long to V+H coordinates. =head1 AUTHOR Paul Timmins, E<lt>paul@timmins.netE<gt> =head1 SEE ALSO L<perl>. =cut