npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mt-geo

v1.0.1

Published

Geodesy representation conversion functions.

Downloads

2,882

Readme

mt-geo

Build Status

Geodesy representation conversion functions.

Installation

$ npm install mt-geo

Usage

The module is initialized like every other Node module.

var geo = require('mt-geo');

The module contains functions for converting geodesy representations.

parseDMS(dms)

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).

  • dms (string|number) Degrees or deg/min/sec in variety of formats
var latitude = geo.parseDMS('51° 28′ 40.12″ N');
// => 51.477811
var longitude = geo.parseDMS('000° 00′ 05.31″ W');
// => -0.001475

toDMS(deg, format, dp)

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

  • deg (number) Degrees
  • format (string, optional) Return value as 'd', 'dm', 'dms'
  • dp (number, optional) No of decimal places to use - default 0 for dms, 2 for dm, 4 for d
var dms = geo.toDMS('47.54');
// => 047°32′24″

toLat(deg, format, dp)

Convert numeric degrees to deg/min/sec latitude (suffixed with N/S).

  • deg (number) Degrees
  • format (string, optional) Return value as 'd', 'dm', 'dms'
  • dp (number, optional) No of decimal places to use - default 0 for dms, 2 for dm, 4 for d
var latitude = geo.toLat('47.54');
// => 47°32′24″N

toLon(deg, format, dp)

Convert numeric degrees to deg/min/sec longitude (suffixed with E/W).

  • deg (number) Degrees
  • format (string, optional) Return value as 'd', 'dm', 'dms'
  • dp (number, optional) No of decimal places to use - default 0 for dms, 2 for dm, 4 for d
var longitude = geo.toLon('47.54');
// => 047°32′24″E

toBearing(deg, format, dp)

Convert numeric degrees to deg/min/sec as a bearing (0º..360º).

  • deg (number) Degrees
  • format (string, optional) Return value as 'd', 'dm', 'dms'
  • dp (number, optional) No of decimal places to use - default 0 for dms, 2 for dm, 4 for d
var bearing = geo.toBearing('47.54');
// => 047°32′24″

Copyright and license

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.