Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-red-contrib-mgrs

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-contrib-mgrs - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

24

mgrs.js
module.exports = function(RED) {
function MGRSNode(n) {
function MGRSString (Lat, Long) {
if (Lat < -80) return 'Too far South' ;
function MGRSString (Lat, Long) {
if (Lat < -80) return 'Too far South' ;
if (Lat > 84) return 'Too far North' ;

@@ -30,3 +30,3 @@ var c = 1 + Math.floor((Long+180)/6);

aa = aa*0.9996 + 500000.0;
ab = ab*0.9996;
ab = ab*0.9996;
if (ab < 0.0) ab += 10000000.0;

@@ -47,3 +47,3 @@ var ad = 'CDEFGHJKLMNPQRSTUVWXX'.charAt (Math.floor (Lat/8 + 10));

val = '0' + val
}
}
return val

@@ -59,3 +59,9 @@ }

b = b.match(/\S+/g);
if (b == null || b.length != 4) return [false,null,null];
if (b == null) return [false,null,null];
if (b.length == 1) {
b = b[0];
var c = b.substr(5)
b = (b.substr(0,3)+" "+b.substr(3,2)+" "+c.substr(5,c.length/2)+" "+c.substr(c.length/2)).split(" ");
}
if (b.length != 4) return [false,null,null];
var c = (b[0].length < 3) ? b[0][0] : b[0].slice(0,2);

@@ -76,3 +82,3 @@ var d = (b[0].length < 3) ? b[0][1] : b[0][2];

if (d < 'N') n -= 10000000.0;
m /= 0.9996;
m /= 0.9996;
n /= 0.9996;

@@ -123,4 +129,4 @@ var o = n / 6367449.14570093;

}
else {
node.error("Bad value "+msg.payload.mgrs,msg);
else {
node.error("Bad value "+msg.payload.mgrs,msg);
}

@@ -127,0 +133,0 @@ node.send(msg);

{
"name" : "node-red-contrib-mgrs",
"version" : "0.1.0",
"version" : "0.1.1",
"description" : "A Node-RED node to convert co-ordinates to and from mgrs",

@@ -5,0 +5,0 @@ "dependencies" : {

@@ -12,3 +12,3 @@ node-red-contrib-mgrs

### Usage
### Usage

@@ -19,2 +19,4 @@ If `msg.payload` contains `.lat` and `.lon` properties, this node adds a corresponding MGRS location as `msg.payload.mgrs`.

msg.payload.mgrs - string - e.g. 30U XB 15652 56680
msg.payload.mgrs - string - e.g. 30U XB 15652 56680
The MGRS may contain less precision if required, e.g. 30U XB 1 5, but does require spaces between the 4 parts.
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc