Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including parse-dms with all npm packages installed. Try it out:

var parseDms = require("parse-dms")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

parse-dms v0.0.3

Parse degrees minutes seconds coordinates to decimal degrees

Build Status


A robust parser for degrees, minutes, seconds latitude and longitude values, with comprehensive tests.


Try it out in the browser.


var parseDMS = require('parse-dms');

parseDMS('59°12\'7.7"N 02°15\'39.6"W')

Returns an object with properties lat lon if it can infer them, or a single number if only one coordinate is provided and it cannot infer lat or lon.

If a DMS coordinate pair is given with no hemisphere letters, then the order is assumed to be lat, lon.

Will throw an error if it cannot parse the string or if degrees, minutes, or seconds are out of range.

Should be able to handle most weird ways that people write DMS values, but if you find one that it cannot handle please submit an issue, or better, submit a pull request with a new test. The regex used is here:

See test/index.js for more details on what it can parse.

Run tests

npm test


Pull requests welcome with tests.

Release History

  • 0.0.1 Initial release
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free