node-red-contrib-web-worldmap 2.23.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,6 @@
1
1
  ### Change Log for Node-RED Worldmap
2
2
 
3
+ - v2.23.1 - Fix saving of custom map layer
3
4
  - v2.23.0 - Give logo and id so it can be overridden by toplogo command. PR #188.
4
5
  - v2.22.3 - Don't show empty popup for geojson object. Issue #186. Add wobble to null island.
5
6
  - v2.22.2 - Be more tolerant of speed string types
package/README.md CHANGED
@@ -11,6 +11,7 @@ map web page for plotting "things" on.
11
11
 
12
12
  ### Updates
13
13
 
14
+ - v2.23.1 - Fix saving of custom map layer
14
15
  - v2.23.0 - Give logo and id so it can be overridden by toplogo command. PR #188.
15
16
  - v2.22.3 - Don't show empty popup for geojson object. Issue #186. Add wobble to null island.
16
17
  - v2.22.2 - Be more tolerant of speed string types
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-web-worldmap",
3
- "version": "2.23.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",
@@ -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
  }