node-red-contrib-web-worldmap 5.0.7 → 5.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,8 @@
1
1
  ### Change Log for Node-RED Worldmap
2
2
 
3
- - v5.0.7 - Tweak SIDC flag handling slightly to show direction if available and moving.
3
+ - v5.0.8 - Fix flag handling for SIDC 2525D, add example.
4
+ - v5.0.7 - Allow Tooltip options (see new example). #PR295.
5
+ - v5.0.6 - Tweak SIDC flag handling slightly to show direction if available and moving.
4
6
  - v5.0.4 - Tweak CoT handling slightly.
5
7
  - v5.0.3 - Add great context menu example flow. PR#290. Bump express lib. PR#291.
6
8
  - v5.0.2 - Fix sidcEdgeIcon docs PR#289.
package/README.md CHANGED
@@ -13,33 +13,34 @@ Feel free to [![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%
13
13
 
14
14
  ### Updates
15
15
 
16
- - v5.0.7 - Allow Tooltip options (see new example). #PR295.
17
- - v5.0.6 - Tweak SIDC flag handling slightly to show direction if available and moving.
18
- - v5.0.4 - Tweak CoT handling slightly.
19
- - v5.0.3 - Add great context menu example flow. PR#290. Bump express lib. PR#291.
20
- - v5.0.2 - Fix sidcEdgeIcon docs PR#289.
21
- - v5.0.1 - Fix isArray error PR #288.
22
- - v5.0.0 - v5.0.0 - Feedback cleanup PR#281, edgeicons option PR#287, bump libs for vuln fixes.
23
- - v4.9.0 - If payload.flag is two char ISO code replace it with flag emoji. Revert part of PR #271
24
- - v4.8.1 - Slight tidy of some of the geojson handling
25
- - v4.8.0 - Merged PR for feedback functionality cleanup and example. PR #271 and #272
26
- - v4.7.0 - Update pmtiles library, fix feedback function inconsistency. Issue #270
27
- - v4.6.5 - Let geojson allow for generic overrides with .icon and .layer.
28
- - v4.6.4 - Fix deletion of layers logic to actually fully remove points.
29
- - v4.6.3 - Fix sending of layer events when not wanted. Issue #262
30
- - v4.6.2 - Fix multiple use of contextmenu feedback. Issue #259
31
- - v4.6.1 - Let default pmtiles be light/dark or monocolored.
32
- - v4.5.2 - Tidy up when pmtiles removed.
33
- - v4.5.0 - Fix pmtiles to look for maps in userdir rather than modules
34
- - v4.4.0 - Add quad(copter) drone icon.
35
- - v4.3.3 - Fix for objects changing layers.
36
- - v4.3.2 - Fix geojson popup missing label name.
37
- - v4.3.1 - Small fix to icon transparency, and routing detail.
38
- - v4.3.0 - Add support for PMtiles files.
39
- - v4.2.1 - Revert use of optional chaining to extend life slightly. Issue #252
40
- - v4.2.0 - Let icons also be inline images data:image...
41
- - v4.1.0 - Add optional SOG, COG, altft, altm input properties.
42
- - v4.0.0 - Breaking - Better context menu variable substitution and retention
16
+ - v5.0.8 - Fix flag handling for SIDC 2525D, add example.
17
+ - v5.0.7 - Allow Tooltip options (see new example). #PR295.
18
+ - v5.0.6 - Tweak SIDC flag handling slightly to show direction if available and moving.
19
+ - v5.0.4 - Tweak CoT handling slightly.
20
+ - v5.0.3 - Add great context menu example flow. PR#290. Bump express lib. PR#291.
21
+ - v5.0.2 - Fix sidcEdgeIcon docs PR#289.
22
+ - v5.0.1 - Fix isArray error PR #288.
23
+ - v5.0.0 - v5.0.0 - Feedback cleanup PR#281, edgeicons option PR#287, bump libs for vuln fixes.
24
+ - v4.9.0 - If payload.flag is two char ISO code replace it with flag emoji. Revert part of PR #271
25
+ - v4.8.1 - Slight tidy of some of the geojson handling
26
+ - v4.8.0 - Merged PR for feedback functionality cleanup and example. PR #271 and #272
27
+ - v4.7.0 - Update pmtiles library, fix feedback function inconsistency. Issue #270
28
+ - v4.6.5 - Let geojson allow for generic overrides with .icon and .layer.
29
+ - v4.6.4 - Fix deletion of layers logic to actually fully remove points.
30
+ - v4.6.3 - Fix sending of layer events when not wanted. Issue #262
31
+ - v4.6.2 - Fix multiple use of contextmenu feedback. Issue #259
32
+ - v4.6.1 - Let default pmtiles be light/dark or monocolored.
33
+ - v4.5.2 - Tidy up when pmtiles removed.
34
+ - v4.5.0 - Fix pmtiles to look for maps in userdir rather than modules
35
+ - v4.4.0 - Add quad(copter) drone icon.
36
+ - v4.3.3 - Fix for objects changing layers.
37
+ - v4.3.2 - Fix geojson popup missing label name.
38
+ - v4.3.1 - Small fix to icon transparency, and routing detail.
39
+ - v4.3.0 - Add support for PMtiles files.
40
+ - v4.2.1 - Revert use of optional chaining to extend life slightly. Issue #252
41
+ - v4.2.0 - Let icons also be inline images data:image...
42
+ - v4.1.0 - Add optional SOG, COG, altft, altm input properties.
43
+ - v4.0.0 - Breaking - Better context menu variable substitution and retention
43
44
  Now uses ${name} syntax rather than $name so we can handle user defined variables in context menus.
44
45
 
45
46
  - see [CHANGELOG](https://github.com/dceejay/RedMap/blob/master/CHANGELOG.md) for full list of changes.
@@ -144,6 +145,10 @@ SIDC codes can be generated using the online tool - https://www.spatialillusions
144
145
 
145
146
  There are lots of extra options you can specify as `msg.payload.options` - see the <a href="https://spatialillusions.com/milsymbol/documentation.html" target="mapinfo">milsymbol docs here</a>.
146
147
 
148
+ Note: If the SIDC code is a 2525C 15 characters long, where chars 13 and 14 are a country code - then the country flag emoji is added to the staffComments field of the icon. If it's a 20 char 2525D code then the options:country property will be used to create the flag.
149
+
150
+ Note: Not all browsers/OS support unicode emoji - if you can see the Swiss flag here (🇨🇭) then you may be OK.
151
+
147
152
  #### TAK Visualisation
148
153
 
149
154
  Users of [TAK](https://tak.gov) can use the [TAK ingest node](https://flows.nodered.org/node/node-red-contrib-tak-registration) to create a JSON formatted TAK event object, received from a TAK server. This can be fed directly into the worldmap node.
@@ -0,0 +1 @@
1
+ [{"id":"2e5fb67b7383373a","type":"worldmap","z":"51335a8bc38f387c","name":"","lat":"","lon":"","zoom":"","layer":"","cluster":"","maxage":"","usermenu":"show","layers":"show","panit":"false","panlock":"false","zoomlock":"false","hiderightclick":"false","coords":"false","showgrid":"false","showruler":"false","allowFileDrop":"false","path":"/worldmap","overlist":"DR,CO,RA,DN","maplist":"OSMG,OSMC,EsriC,EsriS,UKOS","mapname":"","mapurl":"","mapopt":"","mapwms":false,"x":740,"y":120,"wires":[]},{"id":"a43cf3b6fb5c779a","type":"inject","z":"51335a8bc38f387c","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":290,"y":120,"wires":[["814986215a0adc67"]]},{"id":"814986215a0adc67","type":"function","z":"51335a8bc38f387c","name":"2525C with country","func":"msg.payload = {\n name: \"Dave\",\n lat: 51.0,\n lon: -1.20,\n SIDC: \"SFAPC-------GBR\",\n options:{\n staffComments: \"Comment A\",\n direction:220,\n speed:\"111\",\n targetNumber:\"AB1234\",\n additionalInformation:\"some more info\",\n commonIdentifier:\"Hawk\",\n type:\"Some Type\"\n }\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":490,"y":120,"wires":[["2e5fb67b7383373a"]]},{"id":"22188e4b94786964","type":"inject","z":"51335a8bc38f387c","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":290,"y":180,"wires":[["b33a82ee22d45a25"]]},{"id":"b33a82ee22d45a25","type":"function","z":"51335a8bc38f387c","name":"2525D with flag","func":"msg.payload = {\n name: \"Jon\",\n lat: 51.1,\n lon: -1.20,\n SIDC: \"10061500351105000000\",\n flag: \"DE\",\n options: {\n staffComments: \"Comment B\",\n direction: 300,\n speed: \"110\",\n additionalInformation: \"some more info\",\n }\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":180,"wires":[["2e5fb67b7383373a"]]},{"id":"a505c3cbe0ae507a","type":"inject","z":"51335a8bc38f387c","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":290,"y":240,"wires":[["a75fc8cb90ab6b1b"]]},{"id":"a75fc8cb90ab6b1b","type":"function","z":"51335a8bc38f387c","name":"2525D with country","func":"msg.payload = {\n name: \"Mike\",\n lat: 51.0,\n lon: -1.50,\n SIDC: \"10032700000000000000\",\n options: {\n staffComments: \"Comment C\",\n direction: 120,\n country: \"FR\",\n additionalInformation: \"yet more info\",\n }\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":490,"y":240,"wires":[["2e5fb67b7383373a"]]},{"id":"84429b6fce72a6e1","type":"inject","z":"51335a8bc38f387c","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":290,"y":60,"wires":[["374f2d903bb3dc01"]]},{"id":"374f2d903bb3dc01","type":"function","z":"51335a8bc38f387c","name":"2525C with flag","func":"msg.payload = {\n name: \"Joe\",\n lat: 51.1,\n lon: -1.5,\n SIDC: \"SUGPUCATM---\",\n flag: \"CH\",\n options:{\n staffComments: \"Comment D\",\n direction:60,\n speed:\"111\"\n }\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":60,"wires":[["2e5fb67b7383373a"]]}]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-web-worldmap",
3
- "version": "5.0.7",
3
+ "version": "5.0.8",
4
4
  "description": "A Node-RED node to provide a web page of a world map for plotting things on.",
5
5
  "dependencies": {
6
6
  "@turf/bezier-spline": "~7.1.0",
@@ -2123,13 +2123,28 @@ function setMarker(data) {
2123
2123
  }
2124
2124
  opts.size = opts.size || sz;
2125
2125
  opts.size = opts.size * (opts.scale || 1);
2126
- if (data.SIDC.length > 12 && data.SIDC.substr(12,2) !== "**") {
2126
+ if (data.SIDC.length > 12 && /^[A-Za-z]{2}$/gm.test(data.SIDC.substr(12,2))) {
2127
2127
  var cc = data.SIDC.substr(12,2).toLowerCase();
2128
2128
  opts.country = cc.toUpperCase();
2129
2129
  opts.staffComments = emojify(":flag-"+cc+":") + " " + (opts?.staffComments || "");
2130
- data.flag = emojify(":flag-"+cc+":");
2130
+ data.flag = opts.country.toUpperCase() + " " + emojify(":flag-"+cc+":");
2131
2131
  }
2132
- if (data?.speed) { opts.direction = data?.bearing || data?.hdg || data?.COG }
2132
+ if (data.SIDC.length == 12 && data?.flag && data.flag.length == 2) {
2133
+ opts.staffComments = emojify(":flag-"+data.flag.toLowerCase()+":") + " " + (opts?.staffComments || "");
2134
+ }
2135
+ if (data.SIDC.length == 20) {
2136
+ if (opts?.country && opts.country.length == 2) {
2137
+ data.flag = opts.country.toUpperCase() + " " + emojify(":flag-"+opts.country.toLowerCase()+":");
2138
+ opts.country = data.flag;
2139
+ }
2140
+ else if (data?.flag && data.flag.length == 2) {
2141
+ opts.country = data.flag.toUpperCase() + " " + emojify(":flag-"+data.flag.toLowerCase()+":");
2142
+ }
2143
+ }
2144
+ console.log("OPTS",opts)
2145
+ data.speed = opts?.speed || data?.speed; // If SIDC then options.speed can override the speed.
2146
+ if (data?.speed && !opts?.direction) { opts.direction = data?.track || data?.hdg || data?.heading || data?.COG || data?.bearing }
2147
+ if (data.speed == undefined) { delete data.speed; }
2133
2148
  // escape out any isocodes eg flag symbols
2134
2149
  var optfields = ["additionalInformation","higherFormation","specialHeadquarters","staffComments","type","uniqueDesignation","speed","country"];
2135
2150
  //const regex = /\p{Extended_Pictographic}/ug;
@@ -2229,8 +2244,10 @@ function setMarker(data) {
2229
2244
  // data.flag = mmsiToCountry(data.MMSI)
2230
2245
  // }
2231
2246
  if (data?.flag && data.flag.length == 2) {
2232
- const tflg = emojify(":flag-"+data.flag.toLowerCase()+":");
2233
- if (!tflg.includes("flag-")) { data.flag = tflg; }
2247
+ const tflg = data.flag.toUpperCase() + " " + emojify(":flag-"+data.flag.toLowerCase()+":")
2248
+ if (!tflg.includes("flag-")) {
2249
+ data.flag = tflg;
2250
+ }
2234
2251
  }
2235
2252
  if (data.hasOwnProperty("photourl")) {
2236
2253
  words += "<img src=\"" + data.photourl + "\" style=\"max-width:100%; max-height:250px; margin-top:10px;\"><br/>";
@@ -2308,7 +2325,6 @@ function setMarker(data) {
2308
2325
 
2309
2326
  // Add right click contextmenu
2310
2327
  marker = rightmenu(marker);
2311
-
2312
2328
  // Delete more already handled properties
2313
2329
  var llc = data.lineColor ?? data.color;
2314
2330
  delete data.lat;
@@ -3320,15 +3336,15 @@ function doTAKjson(p) {
3320
3336
  d.lon = Number(p.point.lon);
3321
3337
  d.layer = "TAK";
3322
3338
  if (p.type.indexOf('a') === 0) {
3323
- d.hdg = p.detail?.track?.course;
3339
+ d.track = p.detail?.track?.course;
3340
+ if (d.track && d.track == 9999999) { delete d.track; }
3341
+ if (d?.track) { d.track = Math.round(d.track * 100)/100; }
3324
3342
  if (p.detail?.track?.speed) {
3325
3343
  d.speed = Number(p.detail?.track?.speed);
3326
3344
  if (d.speed == 9999999 || d.speed == 0) { delete d.speed; }
3327
3345
  else {
3328
3346
  d.speed = d.speed + " m/s";
3329
- delete d.hdg;
3330
- d.course = p.detail?.track?.course;
3331
- d.options = { direction: d.course };
3347
+ if (d?.track) { d.options = { direction: d.track } };
3332
3348
  }
3333
3349
  }
3334
3350
  if (p.detail?.__group?.name) {
@@ -3355,7 +3371,6 @@ function doTAKjson(p) {
3355
3371
  d.alt = Number(p.point.hae) || 9999999;
3356
3372
  if (d?.alt && parseInt(d.alt) == 9999999) { delete d.alt; }
3357
3373
  else { d.alt = d.alt + "m"; }
3358
- if (d?.hdg && parseInt(d.hdg) == 9999999) { delete d.hdg; }
3359
3374
  setMarker(d);
3360
3375
  }
3361
3376
  else {
@@ -3379,15 +3394,15 @@ function doTAKMCjson(p) {
3379
3394
  d.type = p.type;
3380
3395
  d.uid = p.uid;
3381
3396
  d.name = p.detail?.contact?.callsign || p.uid;
3382
- d.hdg = p.detail?.track?.course;
3397
+ d.track = p.detail?.track?.course;
3398
+ if (d?.track && d.track == 9999999) { delete d.track; }
3399
+ if (d?.track) { d.track = Math.round(d.track * 100)/100; }
3383
3400
  if (p.detail?.track?.speed) {
3384
3401
  d.speed = Number(p.detail?.track?.speed);
3385
3402
  if (d.speed == 9999999 || d.speed == 0) { delete d.speed; }
3386
3403
  else {
3387
3404
  d.speed = d.speed + " m/s";
3388
- delete d.hdg;
3389
- d.course = p.detail?.track?.course;
3390
- d.options = { direction: d.course };
3405
+ if (d?.track) { d.options = { direction: d.track } };
3391
3406
  }
3392
3407
  }
3393
3408
  try {
@@ -3399,7 +3414,6 @@ function doTAKMCjson(p) {
3399
3414
  d.alt = p.hae || 9999999;
3400
3415
  if (d.alt && d.alt == 9999999) { delete d.alt; }
3401
3416
  else { d.alt = d.alt + "m"; }
3402
- if (d.hdg && d.hdg == 9999999) { delete d.hdg; }
3403
3417
  setMarker(d);
3404
3418
  }
3405
3419
  else {