Socket
Socket
Sign inDemoInstall

node-red-contrib-compass

Package Overview
Dependencies
1
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    node-red-contrib-compass

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


Version published
Weekly downloads
22
increased by4.76%
Maintainers
1
Install size
55.7 kB
Created
Weekly downloads
 

Readme

Source

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

Buy my wife a coffee

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:

NameLegend
NNorth
NNENoth-northeast
NENortheast
ENEEast-northeast
EEast
ESEEast-southeast
SESoutheast
SSESouth-southeast
SSouth
SSWSouth-southwest
SWSouthwest
WSWWest-southwest
WWest
WNWWest-northwest
NWNorthwest
NNWNorth-northwest

Keywords

FAQs

Last updated on 27 Aug 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc