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

node-red-contrib-compass

v1.0.1

Published

A Node-RED node to convert a degree to a compass point, or the other way around

Downloads

99

Readme

node-red-contrib-compass

A Node-RED node to convert a degree to a compass point, or the other way around.

Install

Run the following npm command in your Node-RED user directory (typically ~/.node-red):

npm install node-red-contrib-compass

Support my Node-RED developments

Please buy my wife a coffee to keep her happy, while I am busy developing Node-RED stuff for you ...

Node usage

The following example flow demonstrates how to convert a degree into a compass point, or a compass point in into a degree:

Basic flow

[{"id":"bec07115.9b64a","type":"compass-point","z":"11289790.c89848","direction":"toCompass","subset":"secondary","language":"en","inputField":"payload","outputField":"payload","name":"","x":620,"y":680,"wires":[["cc38d99.2386a28"]]},{"id":"122e96c9.988c69","type":"inject","z":"11289790.c89848","name":"","topic":"","payload":"270","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":450,"y":680,"wires":[["bec07115.9b64a"]]},{"id":"cc38d99.2386a28","type":"debug","z":"11289790.c89848","name":"Compass point","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":830,"y":680,"wires":[]},{"id":"6e6a70de.f4f7e","type":"compass-point","z":"11289790.c89848","direction":"toDegree","subset":"secondary","language":"en","inputField":"payload","outputField":"payload","name":"","x":620,"y":740,"wires":[["f863e65b.64a378"]]},{"id":"bba77ff8.e726","type":"inject","z":"11289790.c89848","name":"","topic":"","payload":"W","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":450,"y":740,"wires":[["6e6a70de.f4f7e"]]},{"id":"f863e65b.64a378","type":"debug","z":"11289790.c89848","name":"Degree","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":810,"y":740,"wires":[]}]
  • Conversion from degree to compass point:
    • The input message needs to contain a degree, which is a number between 0 and 360.
    • The output message will contain both the compass point and its description (in the selected language). For example:
      direction: "NNE"
      description: "Noth-northeast"
  • Conversion from compass point to degree:
    • The input message needs to contain a compass point (see table of allowed values below).
    • The output message will contain the degree as a number.

Node properties

Direction

Specify the direction of the convertion:

  • Degree to compass point
  • Compass point to degree

Subset

A subset can be used to fine tune the result, when the direction is "degree to compass point". For example to round to the nearest accepted cardinal direction.

The following subset filters can be selected:

  • Cardinal (4): Restrict the possible cardinals to the main compass quadrant N, E, S, W.
  • Principal (8): Extends the 'Cardinal' option to include NE, SE, SW, NW.
  • Principal + Secondary (16): Extends the 'Principal' to include NNE, ENE, ESE, SSE, SSW, WSW, WNW, NNW.

Language

The language which needs to be used:

  • In the output message, in case the direction is "degree to compass point".
  • In the input message, in case the direction is "compass point to degree".

Remark: when your language is not supported yet and you want to contribute by creating a translation, please have a look at the files in the languages folder and share your translation with me.

Input field

The field name in the input message, that will contain the value that needs to be converted. By default the input value will be located inside the msg.payload field.

Output field

The field name in the output message, that will contain the converted value. By default the output value will be located inside the msg.payload field.

Available cardinal directions

There are 16 major directions available on a compass:

| Name | Legend | | ---- | ------------------ | | N | North | | NNE | Noth-northeast | | NE | Northeast | | ENE | East-northeast | | E | East | | ESE | East-southeast | | SE | Southeast | | SSE | South-southeast | | S | South | | SSW | South-southwest | | SW | Southwest | | WSW | West-southwest | | W | West | | WNW | West-northwest | | NW | Northwest | | NNW | North-northwest |