node-red-contrib-web-worldmap 2.22.2 → 2.23.3
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 +5 -0
- package/README.md +7 -0
- package/examples/Convex Hull around points.json +1 -0
- package/examples/Split Map With Swipe.json +1 -112
- package/examples/Trigger reload of data.json +1 -1
- package/package.json +6 -2
- package/worldmap/index.html +1 -1
- package/worldmap/index3d.html +19 -10
- package/worldmap/leaflet/3dstyle.json +11296 -0
- package/worldmap/worldmap.js +18 -2
- package/worldmap.html +6 -4
- package/worldmap.js +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
### Change Log for Node-RED Worldmap
|
|
2
2
|
|
|
3
|
+
- v2.23.3 - Fix initial laod of maps
|
|
4
|
+
- v2.23.2 - Add convex-hull example
|
|
5
|
+
- v2.23.1 - Fix saving of custom map layer
|
|
6
|
+
- v2.23.0 - Give logo and id so it can be overridden by toplogo command. PR #188.
|
|
7
|
+
- v2.22.3 - Don't show empty popup for geojson object. Issue #186. Add wobble to null island.
|
|
3
8
|
- v2.22.2 - Be more tolerant of speed string types
|
|
4
9
|
- v2.22.0 - Separate out layer events in worldmap in
|
|
5
10
|
- v2.21.9 - Unbreak Drawing layer that I must have broken recently
|
package/README.md
CHANGED
|
@@ -11,6 +11,11 @@ map web page for plotting "things" on.
|
|
|
11
11
|
|
|
12
12
|
### Updates
|
|
13
13
|
|
|
14
|
+
- v2.23.3 - Fix initial laod of maps
|
|
15
|
+
- v2.23.2 - Add convex-hull example
|
|
16
|
+
- v2.23.1 - Fix saving of custom map layer
|
|
17
|
+
- v2.23.0 - Give logo and id so it can be overridden by toplogo command. PR #188.
|
|
18
|
+
- v2.22.3 - Don't show empty popup for geojson object. Issue #186. Add wobble to null island.
|
|
14
19
|
- v2.22.2 - Be more tolerant of speed string types
|
|
15
20
|
- v2.22.0 - Separate out layer events in worldmap in
|
|
16
21
|
- v2.21.9 - Unbreak Drawing layer that I must have broken recently
|
|
@@ -412,6 +417,8 @@ Optional properties include
|
|
|
412
417
|
- **button** - if supplied with a `name` and `icon` property - adds a button to provide user input - sends
|
|
413
418
|
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).
|
|
414
419
|
- **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.
|
|
420
|
+
- **toptitle** - Words to replace title in title bar (if not in iframe)
|
|
421
|
+
- **toplogo** - URL to logo image for top tile bar (if not in iframe) - ideally 60px by 24px.
|
|
415
422
|
|
|
416
423
|
#### To switch layer, move map and zoom
|
|
417
424
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"id":"a0cdb588.2ba408","type":"inject","z":"fc2b85b48b73e276","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":180,"y":90,"wires":[["d7a5c615.1e6578"]],"l":false},{"id":"d7a5c615.1e6578","type":"function","z":"fc2b85b48b73e276","name":"Add Dave","func":"msg.payload = {\n name:\"Dave\",\n lat:51,\n lon:-1,\n layer:\"foo\"\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":90,"wires":[["4b5f6be5.96c1f4","fd654fbf.7e7db"]]},{"id":"7dcb7d4e.f5faa4","type":"function","z":"fc2b85b48b73e276","name":"Add Bob","func":"msg.payload = {\n name:\"Bob\",\n lat:52,\n lon:-1,\n layer:\"foo\"\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":135,"wires":[["4b5f6be5.96c1f4","fd654fbf.7e7db"]]},{"id":"a498ec44.fde27","type":"function","z":"fc2b85b48b73e276","name":"Add Fred","func":"msg.payload = {\n name:\"Fred\",\n lat:51,\n lon:-2,\n layer:\"foo\"\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":180,"wires":[["4b5f6be5.96c1f4","fd654fbf.7e7db"]]},{"id":"5c92395d.d709f8","type":"function","z":"fc2b85b48b73e276","name":"Add Joe","func":"msg.payload = {\n name:\"Joe\",\n lat:52,\n lon:-2,\n layer:\"foo\",\n iconColor:\"blue\"\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":225,"wires":[["4b5f6be5.96c1f4","fd654fbf.7e7db"]]},{"id":"1836dc1e.3ec894","type":"function","z":"fc2b85b48b73e276","name":"Add Mark","func":"msg.payload = {\n name:\"Mark\",\n lat:51.5,\n lon:-1.5,\n layer:\"foo\",\n iconColor:\"green\"\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":270,"wires":[["4b5f6be5.96c1f4","fd654fbf.7e7db"]]},{"id":"d439a183.9d7ca","type":"function","z":"fc2b85b48b73e276","name":"Add John","func":"msg.payload = {\n name:\"John\",\n lat:50.5,\n lon:-2.5,\n layer:\"foo\",\n iconColor:\"blue\"\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":315,"wires":[["4b5f6be5.96c1f4","fd654fbf.7e7db"]]},{"id":"43bc41e8.0385a","type":"function","z":"fc2b85b48b73e276","name":"Remove Mark","func":"msg.payload = {\n name:\"Mark\",\n layer:\"foo\",\n deleted:true\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":570,"wires":[["fd654fbf.7e7db","4b5f6be5.96c1f4"]]},{"id":"4b5f6be5.96c1f4","type":"worldmap-hull","z":"fc2b85b48b73e276","name":"","prop":"layer","x":595,"y":255,"wires":[["fd654fbf.7e7db"]]},{"id":"fd654fbf.7e7db","type":"worldmap","z":"fc2b85b48b73e276","name":"","lat":"","lon":"","zoom":"8","layer":"OSMG","cluster":"","maxage":"","usermenu":"show","layers":"show","panit":"false","panlock":"false","zoomlock":"false","hiderightclick":"false","coords":"none","showgrid":"false","path":"/worldmap","overlist":"CO","maplist":"OSMG,OSMC,OSMH,EsriC,EsriS,EsriT","mapname":"","mapurl":"","mapopt":"","mapwms":false,"x":600,"y":360,"wires":[]},{"id":"38179d31.94a972","type":"function","z":"fc2b85b48b73e276","name":"Remove Dave","func":"msg.payload = {\n name:\"Dave\",\n layer:\"foo\",\n deleted:true\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":390,"wires":[["4b5f6be5.96c1f4","fd654fbf.7e7db"]]},{"id":"b4ebdd.d201a42","type":"function","z":"fc2b85b48b73e276","name":"Remove Bob","func":"msg.payload = {\n name:\"Bob\",\n layer:\"foo\",\n deleted:true\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":435,"wires":[["4b5f6be5.96c1f4","fd654fbf.7e7db"]]},{"id":"4ab765d5.d63b7c","type":"function","z":"fc2b85b48b73e276","name":"Remove Fred","func":"msg.payload = {\n name:\"Fred\",\n layer:\"foo\",\n deleted:true\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":480,"wires":[["fd654fbf.7e7db","4b5f6be5.96c1f4"]]},{"id":"41fbcbe1.602224","type":"function","z":"fc2b85b48b73e276","name":"Remove Joe","func":"msg.payload = {\n name:\"Joe\",\n layer:\"foo\",\n deleted:true\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":525,"wires":[["4b5f6be5.96c1f4","fd654fbf.7e7db"]]},{"id":"0f4e6585f9afbcd7","type":"inject","z":"fc2b85b48b73e276","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":180,"y":135,"wires":[["7dcb7d4e.f5faa4"]],"l":false},{"id":"6c436bd05eaaa4e3","type":"inject","z":"fc2b85b48b73e276","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":180,"y":180,"wires":[["a498ec44.fde27"]],"l":false},{"id":"e97b916faeca80c5","type":"inject","z":"fc2b85b48b73e276","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":180,"y":225,"wires":[["5c92395d.d709f8"]],"l":false},{"id":"611d3c4798865b0c","type":"inject","z":"fc2b85b48b73e276","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":180,"y":270,"wires":[["1836dc1e.3ec894"]],"l":false},{"id":"3c835edcbc03e15f","type":"inject","z":"fc2b85b48b73e276","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":180,"y":315,"wires":[["d439a183.9d7ca"]],"l":false},{"id":"029fdb18b1447049","type":"inject","z":"fc2b85b48b73e276","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":180,"y":390,"wires":[["38179d31.94a972"]],"l":false},{"id":"9d473630bf56f60d","type":"inject","z":"fc2b85b48b73e276","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":180,"y":435,"wires":[["b4ebdd.d201a42"]],"l":false},{"id":"0efe0d29dc967c6b","type":"inject","z":"fc2b85b48b73e276","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":180,"y":480,"wires":[["4ab765d5.d63b7c"]],"l":false},{"id":"c059eda796d691f4","type":"inject","z":"fc2b85b48b73e276","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":180,"y":525,"wires":[["41fbcbe1.602224"]],"l":false},{"id":"78fe9cfb7d147384","type":"inject","z":"fc2b85b48b73e276","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":180,"y":570,"wires":[["43bc41e8.0385a"]],"l":false},{"id":"26d08e189f6137c0","type":"function","z":"fc2b85b48b73e276","name":"Remove John","func":"msg.payload = {\n name:\"John\",\n layer:\"foo\",\n deleted:true\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":615,"wires":[["fd654fbf.7e7db","4b5f6be5.96c1f4"]]},{"id":"ba88e8b9f69dc254","type":"inject","z":"fc2b85b48b73e276","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":180,"y":615,"wires":[["26d08e189f6137c0"]],"l":false}]
|
|
@@ -1,112 +1 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"id": "2e9ce367.acdb9c",
|
|
4
|
-
"type": "worldmap",
|
|
5
|
-
"z": "82738787.0e0338",
|
|
6
|
-
"name": "",
|
|
7
|
-
"lat": "",
|
|
8
|
-
"lon": "",
|
|
9
|
-
"zoom": "8",
|
|
10
|
-
"layer": "OSM",
|
|
11
|
-
"cluster": "0",
|
|
12
|
-
"maxage": "",
|
|
13
|
-
"usermenu": "show",
|
|
14
|
-
"layers": "show",
|
|
15
|
-
"panit": "false",
|
|
16
|
-
"path": "/worldmap",
|
|
17
|
-
"x": 580,
|
|
18
|
-
"y": 920,
|
|
19
|
-
"wires": []
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"id": "8d0f8d4c.3cd21",
|
|
23
|
-
"type": "function",
|
|
24
|
-
"z": "82738787.0e0338",
|
|
25
|
-
"name": "remove split",
|
|
26
|
-
"func": "msg.payload = {command:{side:\"none\"}};\nreturn msg;",
|
|
27
|
-
"outputs": 1,
|
|
28
|
-
"noerr": 0,
|
|
29
|
-
"x": 390,
|
|
30
|
-
"y": 980,
|
|
31
|
-
"wires": [
|
|
32
|
-
[
|
|
33
|
-
"2e9ce367.acdb9c"
|
|
34
|
-
]
|
|
35
|
-
]
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"id": "311acf75.93ff8",
|
|
39
|
-
"type": "function",
|
|
40
|
-
"z": "82738787.0e0338",
|
|
41
|
-
"name": "Satellite",
|
|
42
|
-
"func": "msg.payload = {\n command:{\n side: \"Esri Satellite\", \n split: 66,\n showlayer: \"roads\"\n }\n};\nreturn msg;",
|
|
43
|
-
"outputs": 1,
|
|
44
|
-
"noerr": 0,
|
|
45
|
-
"x": 400,
|
|
46
|
-
"y": 920,
|
|
47
|
-
"wires": [
|
|
48
|
-
[
|
|
49
|
-
"2e9ce367.acdb9c"
|
|
50
|
-
]
|
|
51
|
-
]
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"id": "eaea1a90.f27b98",
|
|
55
|
-
"type": "worldmap in",
|
|
56
|
-
"z": "82738787.0e0338",
|
|
57
|
-
"name": "",
|
|
58
|
-
"path": "/worldmap",
|
|
59
|
-
"x": 100,
|
|
60
|
-
"y": 920,
|
|
61
|
-
"wires": [
|
|
62
|
-
[
|
|
63
|
-
"4540d879.244f88"
|
|
64
|
-
]
|
|
65
|
-
]
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"id": "4540d879.244f88",
|
|
69
|
-
"type": "switch",
|
|
70
|
-
"z": "82738787.0e0338",
|
|
71
|
-
"name": "",
|
|
72
|
-
"property": "payload.action",
|
|
73
|
-
"propertyType": "msg",
|
|
74
|
-
"rules": [
|
|
75
|
-
{
|
|
76
|
-
"t": "eq",
|
|
77
|
-
"v": "connected",
|
|
78
|
-
"vt": "str"
|
|
79
|
-
}
|
|
80
|
-
],
|
|
81
|
-
"checkall": "true",
|
|
82
|
-
"repair": false,
|
|
83
|
-
"outputs": 1,
|
|
84
|
-
"x": 250,
|
|
85
|
-
"y": 920,
|
|
86
|
-
"wires": [
|
|
87
|
-
[
|
|
88
|
-
"311acf75.93ff8"
|
|
89
|
-
]
|
|
90
|
-
]
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
"id": "f77366dc.818138",
|
|
94
|
-
"type": "inject",
|
|
95
|
-
"z": "82738787.0e0338",
|
|
96
|
-
"name": "",
|
|
97
|
-
"topic": "",
|
|
98
|
-
"payload": "",
|
|
99
|
-
"payloadType": "str",
|
|
100
|
-
"repeat": "",
|
|
101
|
-
"crontab": "",
|
|
102
|
-
"once": false,
|
|
103
|
-
"onceDelay": 0.1,
|
|
104
|
-
"x": 110,
|
|
105
|
-
"y": 980,
|
|
106
|
-
"wires": [
|
|
107
|
-
[
|
|
108
|
-
"8d0f8d4c.3cd21"
|
|
109
|
-
]
|
|
110
|
-
]
|
|
111
|
-
}
|
|
112
|
-
]
|
|
1
|
+
[{"id":"2e9ce367.acdb9c","type":"worldmap","z":"e956b3364e3ffca6","name":"","lat":"","lon":"","zoom":"8","layer":"OSMG","cluster":"0","maxage":"","usermenu":"show","layers":"show","panit":"false","hiderightclick":"false","coords":"none","path":"/worldmap","overlist":"CO","maplist":"OSMG,OSMC,OSMH,EsriC,EsriS,EsriT,EsriO","mapname":"","mapurl":"","mapopt":"","mapwms":false,"x":570,"y":600,"wires":[]},{"id":"8d0f8d4c.3cd21","type":"function","z":"e956b3364e3ffca6","name":"remove split","func":"msg.payload = {command:{side:\"none\"}};\nreturn msg;","outputs":1,"noerr":0,"x":380,"y":660,"wires":[["2e9ce367.acdb9c"]]},{"id":"311acf75.93ff8","type":"function","z":"e956b3364e3ffca6","name":"Satellite","func":"msg.payload = {\n command:{\n side: \"Esri Satellite\", \n split: 66,\n showlayer: \"roads\"\n }\n};\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":600,"wires":[["2e9ce367.acdb9c"]]},{"id":"eaea1a90.f27b98","type":"worldmap in","z":"e956b3364e3ffca6","name":"","path":"/worldmap","events":"connect","x":90,"y":600,"wires":[["4540d879.244f88"]]},{"id":"4540d879.244f88","type":"switch","z":"e956b3364e3ffca6","name":"","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"connected","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":240,"y":600,"wires":[["311acf75.93ff8"]]},{"id":"f77366dc.818138","type":"inject","z":"e956b3364e3ffca6","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":100,"y":660,"wires":[["8d0f8d4c.3cd21"]]}]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"id":"62ae3b3c.8de704","type":"worldmap in","z":"
|
|
1
|
+
[{"id":"62ae3b3c.8de704","type":"worldmap in","z":"e956b3364e3ffca6","name":"","path":"/worldmap","events":"connect","x":165,"y":630,"wires":[["2eadb3d5.d063ec","259809c4.43edf6"]]},{"id":"2eadb3d5.d063ec","type":"debug","z":"e956b3364e3ffca6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":335,"y":590,"wires":[]},{"id":"259809c4.43edf6","type":"switch","z":"e956b3364e3ffca6","name":"","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"connected","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":335,"y":630,"wires":[[]]},{"id":"13a00ba8.dcc8e4","type":"comment","z":"e956b3364e3ffca6","name":"Reload trigger","info":"The output from the switch will fire whenever a browser connects (or reconnects).\n\nThis can be used to retrieve stored datapoints and resend them to the map, as by default the main does not retain any sata between refreshes.\n\nThe debug node will show other properties that may be useful to trigger other actions.\n","x":175,"y":590,"wires":[]}]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-web-worldmap",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.23.3",
|
|
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",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"world"
|
|
28
28
|
],
|
|
29
29
|
"node-red": {
|
|
30
|
+
"version": ">=1.0.0",
|
|
30
31
|
"nodes": {
|
|
31
32
|
"worldmap": "worldmap.js"
|
|
32
33
|
}
|
|
@@ -38,5 +39,8 @@
|
|
|
38
39
|
},
|
|
39
40
|
"contributors": [
|
|
40
41
|
"@HiroyasuNishiyama"
|
|
41
|
-
]
|
|
42
|
+
],
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=10"
|
|
45
|
+
}
|
|
42
46
|
}
|
package/worldmap/index.html
CHANGED
|
@@ -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"
|
|
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">
|
package/worldmap/index3d.html
CHANGED
|
@@ -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/
|
|
10
|
-
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/
|
|
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
|
-
//
|
|
21
|
-
|
|
22
|
-
//
|
|
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
|
-
|
|
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': .
|
|
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
|
}
|