node-red-contrib-web-worldmap 4.4.0 → 4.5.0

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,5 +1,6 @@
1
1
  ### Change Log for Node-RED Worldmap
2
2
 
3
+ - v4.5.0 - Fix pmtiles to look for maps in userdir rather than modules
3
4
  - v4.4.0 - Add quad(copter) drone icon.
4
5
  - v4.3.3 - Fix for objects changing layers.
5
6
  - v4.3.2 - Fix geojson popup missing label name.
package/README.md CHANGED
@@ -13,6 +13,7 @@ Feel free to [![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%
13
13
 
14
14
  ### Updates
15
15
 
16
+ - v4.5.0 - Fix pmtiles to look for maps in userdir rather than modules
16
17
  - v4.4.0 - Add quad(copter) drone icon.
17
18
  - v4.3.3 - Fix for objects changing layers.
18
19
  - v4.3.2 - Fix geojson popup missing label name.
@@ -720,7 +721,7 @@ You can use a PMtiles format map archive file from [Protomaps](https://docs.prot
720
721
 
721
722
  **Note**: the whole planet file is over 100GB so be warned both for local storage and your download speed. You can download or extract just a portion of it if you use the **pmtiles** command line with the extract option. Use `pmtiles extract --help` to see the options.
722
723
 
723
- Copy, or create an alias to, your .pmtiles file(s) into your `~/.node-red/node_modules/node-red-contrib-web-worldmap/worldmap/` directory. On re-starting Node-RED the node will detect the file(s) and add them to the base map layer menu, using the file name as the layer name.
724
+ Copy your .pmtiles file(s) into your `~/.node-red` user directory. On re-starting Node-RED the node will detect the file(s) and add them to the base map layer menu, using the file name as the layer name.
724
725
 
725
726
  ### Using a Docker Map Server
726
727
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-web-worldmap",
3
- "version": "4.4.0",
3
+ "version": "4.5.0",
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": "~6.5.0",
package/worldmap.html CHANGED
@@ -1,4 +1,8 @@
1
1
  <script type="text/html" data-template-name="worldmap">
2
+ <div class="form-row">
3
+ <label for="node-input-name"><i class="fa fa-file"></i> Name</label>
4
+ <input type="text" id="node-input-name" placeholder="name">
5
+ </div>
2
6
  <div class="form-row">
3
7
  <table border="0" width="96%">
4
8
  <tr><td width="100px"><i class="fa fa-globe"></i> Start<td>Latitude</td><td>Longitude</td><td width="60px">Zoom</td></tr>
@@ -108,10 +112,6 @@
108
112
  <option value="true">Enable</option>
109
113
  </select>
110
114
  </div>
111
- <div class="form-row">
112
- <label for="node-input-name"><i class="fa fa-file"></i> Name</label>
113
- <input type="text" id="node-input-name" placeholder="name">
114
- </div>
115
115
  <div class="form-tips">Set <i>Cluster when</i> to 0 to disable clustering of points.<br/>
116
116
  If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>ctrl-shift-m</code> will load the map in a new tab.</div>
117
117
  </script>
@@ -155,6 +155,10 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
155
155
 
156
156
 
157
157
  <script type="text/html" data-template-name="ui_worldmap">
158
+ <div class="form-row">
159
+ <label for="node-input-name"><i class="fa fa-file"></i> Name</label>
160
+ <input type="text" id="node-input-name" placeholder="name">
161
+ </div>
158
162
  <div class="form-row" id="template-row-group">
159
163
  <label for="node-input-group"><i class="fa fa-table"></i> Group</span></label>
160
164
  <input type="text" id="node-input-group">
@@ -274,10 +278,6 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
274
278
  <option value="true">Enable</option>
275
279
  </select>
276
280
  </div>
277
- <div class="form-row">
278
- <label for="node-input-name"><i class="fa fa-file"></i> Name</label>
279
- <input type="text" id="node-input-name" placeholder="name">
280
- </div>
281
281
  <div class="form-tips">Set <i>Cluster when</i> to 0 to disable clustering of points.<br/>
282
282
  If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>ctrl-shift-m</code> will load the map in a new tab.</div>
283
283
  </script>
@@ -593,6 +593,10 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
593
593
 
594
594
 
595
595
  <script type="text/html" data-template-name="worldmap in">
596
+ <div class="form-row">
597
+ <label for="node-input-name"><i class="fa fa-file"></i> Name</label>
598
+ <input type="text" id="node-input-name" placeholder="name">
599
+ </div>
596
600
  <div class="form-row">
597
601
  <label for="node-input-path"><i class="fa fa-globe"></i> Web Path</label>
598
602
  <input type="text" id="node-input-path" placeholder="worldmap">
@@ -601,10 +605,6 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
601
605
  <label for="node-input-events"><i class="fa fa-sign-out"></i> Events</label>
602
606
  <input type="text" id="node-input-events" placeholder="select events">
603
607
  </div>
604
- <div class="form-row">
605
- <label for="node-input-name"><i class="fa fa-file"></i> Name</label>
606
- <input type="text" id="node-input-name" placeholder="name">
607
- </div>
608
608
  </script>
609
609
 
610
610
  <script type="text/html" data-help-name="worldmap in">
@@ -679,6 +679,10 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
679
679
 
680
680
 
681
681
  <script type="text/html" data-template-name="worldmap-tracks">
682
+ <div class="form-row">
683
+ <label for="node-input-name"><i class="fa fa-file"></i> Name</label>
684
+ <input type="text" id="node-input-name" placeholder="name">
685
+ </div>
682
686
  <div class="form-row">
683
687
  <label for="node-input-depth"><i class="fa fa-map-marker"></i> Number of</label>
684
688
  points in track <input type="text" id="node-input-depth" style="width:50%" placeholder="number - default 20">
@@ -696,10 +700,6 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
696
700
  <input type="checkbox" id="node-input-smooth" style="display:inline-block; width:auto; vertical-align:top;">
697
701
  <label for="node-input-smooth" style="width:70%;">Smooth tracks using bezier curves.</label>
698
702
  </div>
699
- <div class="form-row">
700
- <label for="node-input-name"><i class="fa fa-file"></i> Name</label>
701
- <input type="text" id="node-input-name" placeholder="name">
702
- </div>
703
703
  </script>
704
704
 
705
705
  <script type="text/html" data-help-name="worldmap-tracks">
@@ -739,14 +739,14 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
739
739
 
740
740
 
741
741
  <script type="text/html" data-template-name="worldmap-hull">
742
- <div class="form-row">
743
- <label for="node-input-prop"><i class="fa fa-ellipsis-h"></i> Property</label>
744
- <input type="text" id="node-input-prop" placeholder="payload property to group">
745
- </div>
746
742
  <div class="form-row">
747
743
  <label for="node-input-name"><i class="fa fa-file"></i> Name</label>
748
744
  <input type="text" id="node-input-name" placeholder="name">
749
745
  </div>
746
+ <div class="form-row">
747
+ <label for="node-input-prop"><i class="fa fa-ellipsis-h"></i> Property</label>
748
+ <input type="text" id="node-input-prop" placeholder="payload property to group">
749
+ </div>
750
750
  </script>
751
751
 
752
752
  <script type="text/html" data-help-name="worldmap-hull">
package/worldmap.js CHANGED
@@ -13,7 +13,8 @@ module.exports = function(RED) {
13
13
  if (fs.existsSync((__dirname + '/mapserv'))) {
14
14
  RED.httpNode.use("/cgi-bin/mapserv", require('cgi')(__dirname + '/mapserv'));
15
15
  }
16
- var pmtiles = fs.readdirSync(__dirname + '/worldmap').filter(fn => fn.endsWith('.pmtiles'));
16
+ //var pmtiles = fs.readdirSync(__dirname + '/worldmap').filter(fn => fn.endsWith('.pmtiles'));
17
+ var pmtiles = fs.readdirSync(RED.settings.userDir).filter(fn => fn.endsWith('.pmtiles'));
17
18
 
18
19
  function worldMap(node, n) {
19
20
  var allPoints = {};
@@ -121,7 +122,14 @@ module.exports = function(RED) {
121
122
  //console.log("INIT",c)
122
123
  client.write(JSON.stringify({command:c}));
123
124
  for (var p=0; p<pmtiles.length; p++) {
124
- client.write(JSON.stringify({command: {map: {name:pmtiles[p].split('.')[0], pmtiles:pmtiles[p] }}}));
125
+ fs.symlink(RED.settings.userDir+'/'+pmtiles[p], __dirname+'/worldmap/'+pmtiles[p], 'file', (err) => {
126
+ if (err) {
127
+ if (err.code !== "EEXIST") { console.log(err); }
128
+ }
129
+ else {
130
+ client.write(JSON.stringify({command: {map: {name:pmtiles[p].split('.')[0], pmtiles:pmtiles[p] }}}));
131
+ }
132
+ })
125
133
  }
126
134
  var o = Object.values(allPoints);
127
135
  o.map(v => delete v.tout);