parse sexagesimal coordinates
JavaScript
Latest commit 911a3fd Aug 7, 2015 @tmcw tmcw Fix repo
Permalink
Failed to load latest commit information.
bin expose to cli Dec 5, 2014
test Fix tests, expand test coverage Aug 7, 2015
.travis.yml New node Aug 7, 2015
CHANGELOG.md Update changelog Aug 7, 2015
README.md Fix badge Aug 7, 2015
index.js Reformat Aug 7, 2015
package.json Fix repo Aug 7, 2015
sexagesimal.js Remake Mar 17, 2014

README.md

Build Status

sexagesimal

Convert between sexagesimal coordinates and decimal coordinates.

usage

with npm (and/or) browserify

npm install sexagesimal

otherwise

curl https://raw.github.com/mapbox/sexagesimal/master/sexagesimal.js

example

sexagesimal('66° 30′ 360″ N') // 66.6
sexagesimal('66° 30′ 720″ S') // -66.7
sexagesimal('66° 30′ 720" S') // -66.7
sexagesimal('66° 30′ 720" E') // 66.7
sexagesimal('66° 30′ 720" W') // -66.7
sexagesimal.pair('66N 32W') // [66, -32]

api

sexagesimal(str, dims) // returns a number or null

dims is by default NSEW but can be other ordinal directions expressed as a string of characters.

sexagesimal.pair(str, dims) // returns [lat, lon] or null

dims is by default NSEW but can be other ordinal directions expressed as a string of characters.

sexagesimal.format(float, dimension) // returns a formatted string

Format a single sexagesimal number. dimension must be a string, either "lat" or "lon".

sexagesimal.formatPair({ lat: float, lon: float }) // returns a formatted string

Format a sexagesimal coordinate.