geo::ecef - Functions for calculating ecef coordinates from lla
use geo::ecef; ($lat,$lon,height)=(60,45,0); # Decimal degrees and height in meters $x=X($lat,$lon,height); $y=Y($lat,$lon,height); $z=Z($lat,$lon,height); # proj4 output @p4=split/\s/,'30d44\'15.43"N 55d16\'12.33"E'; $lat=p2dd($p4[0]); $lon=p2dd($p4[1]);
geo::ecef contains functions for calculating the X,Y and Z coordinates in the ecef (earth centered earth fixed) coordinate system from latitude, longitude and height information. The wgs84 ellepsoide is used as a basis for the calculation.
In addition, geo::ecef contains an utilty function to read output from the proj4 projection utility
The formulaes were found at http://www.u-blox.ch.
X($lat,$lon,$height,$rad)
calculates the ecef X-coordinate from the latitude, longitude and height. The lat and lon is considered beeing degrees, unless $rad is set to a true value, in which case they are considered to be radianes.
calculates the Y-coordinate, else similiar to X()
calculates the Z-coordinate, else similiar to X()
p2dd takes a latitude or longitude as output by proj4 and converts it to decimal degrees. The input format is on the form 71d3'56.623"N. undef is returned for invalid values, i.e. min or sec >= 60.
This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
(c) by Morten Sickel http://sickel.net/ 2005
To install geo::ecef, copy and paste the appropriate command in to your terminal.
cpanm
cpanm geo::ecef
CPAN shell
perl -MCPAN -e shell install geo::ecef
For more information on module installation, please visit the detailed CPAN module installation guide.