node-red-contrib-web-worldmap 2.22.0 → 2.23.1

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,9 @@
1
1
  ### Change Log for Node-RED Worldmap
2
2
 
3
+ - v2.23.1 - Fix saving of custom map layer
4
+ - v2.23.0 - Give logo and id so it can be overridden by toplogo command. PR #188.
5
+ - v2.22.3 - Don't show empty popup for geojson object. Issue #186. Add wobble to null island.
6
+ - v2.22.2 - Be more tolerant of speed string types
3
7
  - v2.22.0 - Separate out layer events in worldmap in
4
8
  - v2.21.9 - Unbreak Drawing layer that I must have broken recently
5
9
  - v2.21.8 - Let SIDC/icon short code be only 4 chars long
package/README.md CHANGED
@@ -11,6 +11,10 @@ map web page for plotting "things" on.
11
11
 
12
12
  ### Updates
13
13
 
14
+ - v2.23.1 - Fix saving of custom map layer
15
+ - v2.23.0 - Give logo and id so it can be overridden by toplogo command. PR #188.
16
+ - v2.22.3 - Don't show empty popup for geojson object. Issue #186. Add wobble to null island.
17
+ - v2.22.2 - Be more tolerant of speed string types
14
18
  - v2.22.0 - Separate out layer events in worldmap in
15
19
  - v2.21.9 - Unbreak Drawing layer that I must have broken recently
16
20
  - v2.21.8 - Let SIDC/icon short code be only 4 chars long
@@ -411,6 +415,8 @@ Optional properties include
411
415
  - **button** - if supplied with a `name` and `icon` property - adds a button to provide user input - sends
412
416
  a msg `{"action":"button", "name":"the_button_name"}` to the worldmap in node. If supplied with a `name` property only, it will remove the button. Optional `position` property can be 'bottomright', 'bottomleft', 'topleft' or 'topright' (default).
413
417
  - **contextmenu** - html string to define the right click menu when not on a marker. Defaults to the simple add marker input. Empty string `""` disables this right click.
418
+ - **toptitle** - Words to replace title in title bar (if not in iframe)
419
+ - **toplogo** - URL to logo image for top tile bar (if not in iframe) - ideally 60px by 24px.
414
420
 
415
421
  #### To switch layer, move map and zoom
416
422
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-web-worldmap",
3
- "version": "2.22.0",
3
+ "version": "2.23.1",
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",
@@ -80,7 +80,7 @@
80
80
 
81
81
  <body>
82
82
  <div id="topbar">
83
- <a href="https://nodered.org"><img src="images/node-red.png" width="60" height="24" alt="NRed"/></a>
83
+ <a href="https://nodered.org" id="toplink"><img id="toplogo" src="images/node-red.png" style="max-width:60px; height:24px; margin-top:-3px" alt="NRed"/></a>
84
84
  <span class="topbar" id="topwords"> Node-RED - map all the things</span>
85
85
  </div>
86
86
  <div id="results">
@@ -6,8 +6,8 @@
6
6
  <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no'/>
7
7
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
8
8
  <script src="leaflet/sockjs.min.js"></script>
9
- <script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.46.0/mapbox-gl.js'></script>
10
- <link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.46.0/mapbox-gl.css' rel='stylesheet'/>
9
+ <script src='https://api.tiles.mapbox.com/mapbox-gl-js/v2.6.1/mapbox-gl.js'></script>
10
+ <link href='https://api.tiles.mapbox.com/mapbox-gl-js/v2.6.1/mapbox-gl.css' rel='stylesheet'/>
11
11
  <style>
12
12
  body { margin:0; padding:0; }
13
13
  #map { position:absolute; top:0; bottom:0; width:100%; }
@@ -17,11 +17,21 @@
17
17
  <div id='map'></div>
18
18
  <script>
19
19
 
20
- // If you have a mapbox API key it may be better to use that - uncomment these lines and comment out the mbstyle below.
21
- // mapboxgl.accessToken = 'insert your key here';
22
- // var mbstyle = 'mapbox://styles/mapbox/streets-v9';
20
+ // TO MAKE THE MAP APPEAR YOU MUST ADD YOUR ACCESS TOKEN FROM https://account.mapbox.com
21
+ mapboxgl.accessToken = '';
22
+ //mapboxgl.accessToken = 'pk.eyJ1IjoiZGNlZWpheSIsImEiOiJjaml1aDR6ejQwMml0M3dtdGFlbmEyZHVpIn0.3aD-974hxir335vuLjHOSg';
23
+ mapboxgl.accessToken = 'pk.eyJ1Ijoib3NtYnVpbGRpbmdzIiwiYSI6IjNldU0tNDAifQ.c5EU_3V8b87xO24tuWil0w';
24
+ // if (process.env.MAPBOXGL_TOKEN) {
25
+ // mapboxgl.accessToken = process.env.MAPBOXGL_TOKEN
26
+ // }
23
27
 
24
- var mbstyle = 'https://data.osmbuildings.org/0.2/anonymous/style.json';
28
+ if (mapboxgl.accessToken === "") {
29
+ alert("To make the map apperar you must add your Access Token from https://account.mapbox.com")
30
+ }
31
+
32
+ var mbstyle = 'mapbox://styles/mapbox/streets-v10';
33
+ // var mbstyle = 'mapbox://styles/mapbox/light-v10';
34
+ // var mbstyle = 'https://data.osmbuildings.org/0.2/anonymous/style.json';
25
35
 
26
36
  var map = new mapboxgl.Map({
27
37
  container: 'map',
@@ -35,7 +45,6 @@ var map = new mapboxgl.Map({
35
45
 
36
46
  var people = {};
37
47
 
38
-
39
48
  map.on('load', function() {
40
49
 
41
50
  var layers = map.getStyle().layers;
@@ -65,7 +74,7 @@ map.on('load', function() {
65
74
  "interpolate", ["linear"], ["zoom"],
66
75
  15, 0, 15.05, ["get", "min_height"]
67
76
  ],
68
- 'fill-extrusion-opacity': .3
77
+ 'fill-extrusion-opacity': .4
69
78
  }
70
79
  }, firstSymbolId);
71
80
 
@@ -199,8 +208,8 @@ map.on('load', function() {
199
208
  //console.log({p},{t},{fac},{base},{tall});
200
209
  var sin = 1;
201
210
  var cos = 0;
202
- p.hdg = p.hdg || p.heading;
203
- if (p.hasOwnProperty("hdg")) {
211
+ p.hdg = Number(p.hdg || p.heading);
212
+ if (p.hasOwnProperty("hdg") && !isNaN(p.hdg)) {
204
213
  sin = Math.sin((90 - p.hdg) * Math.PI / 180);
205
214
  cos = Math.cos((90 - p.hdg) * Math.PI / 180);
206
215
  }