geo-coordinates-decimaldegrees's Introduction
NAME Geo::Coordinates::DecimalDegrees - convert between degrees/minutes/seconds and decimal degrees SYNOPSIS use Geo::Coordinates::DecimalDegrees; ($degrees, $minutes, $seconds, $sign) = decimal2dms($decimal_degrees); ($degrees, $minutes, $sign) = decimal2dm($decimal_degrees); $decimal_degrees = dms2decimal($degrees, $minutes, $seconds); $decimal_degrees = dm2decimal($degrees, $minutes); DESCRIPTION Latitudes and longitudes are most often presented in two common formats: decimal degrees, and degrees, minutes and seconds. There are 60 minutes in a degree, and 60 seconds in a minute. In decimal degrees, the minutes and seconds are presented as a fractional number of degrees. For example, 1 degree 30 minutes is 1.5 degrees, and 30 minutes 45 seconds is 0.5125 degrees. This module provides functions for converting between these two formats. FUNCTIONS This module provides the following functions, which are all exported by default when you call "use Geo::Coordinates::DecimalDegrees;": decimal2dms($decimal_degrees) Converts a floating point number of degrees to the equivalent number of degrees, minutes, and seconds, which are returned as a 3-element list. Typically used as follows: ($degrees, $minutes, $seconds) = decimal2dms($decimal_degrees); If $decimal_degrees is negative, only $degrees will be negative. $minutes and $seconds will always be positive. If $decimal_degrees is between 0 and -1, $degrees will be returned as 0. If you need to know the sign in these cases, you can use this longer version, where $sign is 1, 0, or -1 depending on whether $decimal_degrees is positive, 0, or negative: ($degrees, $minutes, $seconds, $sign) = decimal2dms($decimal_degrees); decimal2dm($decimal_degrees) Converts a floating point number of degrees to the equivalent number of degrees and minutes which are returned as a 2-element list. Typically used as follows: ($degrees, $minutes) = decimal2dm($decimal_degrees); If $decimal_degrees is negative, only $degrees will be negative. $minutes will always be positive. If $decimal_degrees is between 0 and -1, $degrees will be returned as 0. If you need to know the sign in these cases, you can use this longer version, where $sign is 1, 0, or -1 depending on whether $decimal_degrees is positive, 0, or negative: ($degrees, $minutes, $sign) = decimal2dm($decimal_degrees); dms2decimal($degrees, $minutes, $seconds) Converts degrees, minutes, and seconds to the equivalent number of decimal degrees: $decimal_degrees = dms2decimal($degrees, $minutes, $seconds); If $degrees is negative, then $decimal_degrees will also be negative. dm2decimal($degrees, $minutes) Converts degrees and minutes to the equivalent number of decimal degrees: $decimal_degrees = dm2decimal($degrees, $minutes); If $degrees is negative, then $decimal_degrees will also be negative. CAVEATS The functions don't do any sanity checks on their arguments. If you have a good reason to convert 61 minutes -101 seconds to decimal, go right ahead. AUTHOR Walt Mankowski, <[email protected]> COPYRIGHT AND LICENSE Copyright 2003-2011 by Walt Mankowski This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. THANKS Thanks to Andy Lester for telling me about pod.t Thanks to Paulie Pena IV for pointing out that I could remove a division in decimal2dms(). Thanks to Tim Flohrer for reporting the bug in decimal2dms() and decimal2dm() when $decimal_degrees is between 0 and -1.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.