Geodesy representation conversion functions.
$ npm install mt-geo
The module is initialized like every other Node module.
var geo = ;
The module contains functions for converting geodesy representations.
Parses string representing degrees/minutes/seconds into numeric degrees.
This is very flexible on formats, allowing signed decimal degrees, or deg-min-sec optionally suffixed by compass direction (NSEW). A variety of separators are accepted (eg 3º 37' 09"W) or fixed-width format without separators (eg. 0033709W). Seconds and minutes may be omitted. (Note minimal validation is done).
var latitude = geo;// => 51.477811var longitude = geo;// => -0.001475
Convert decimal degrees to deg/min/sec format. Degree, prime, double-prime symbols are added, but sign is discarded, though no compass direction is added
var dms = geo;// => 047°32′24″
Convert numeric degrees to deg/min/sec latitude (suffixed with N/S).
var latitude = geo;// => 47°32′24″N
Convert numeric degrees to deg/min/sec longitude (suffixed with E/W).
var longitude = geo;// => 047°32′24″E
Convert numeric degrees to deg/min/sec as a bearing (0º..360º).
var bearing = geo;// => 047°32′24″
The original code was written by Chris Veness and can be found at http://www.movable-type.co.uk/scripts/latlong.html. It is released under the simple Creative Commons attribution license (http://creativecommons.org/licenses/by/3.0/).
This project is released under the MIT license.