node-red-contrib-web-worldmap 2.38.0 → 2.38.2
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 +3 -1
- package/README.md +15 -28
- package/package.json +1 -1
- package/worldmap/worldmap.js +23 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
### Change Log for Node-RED Worldmap
|
|
2
2
|
|
|
3
|
+
- v2.38.2 - Better fix for geojson multipoint icons.
|
|
4
|
+
- v2.38.1 - Fix for geojson multipoint icons.
|
|
3
5
|
- v2.38.0 - Return client headers as part of connect message.
|
|
4
6
|
- v2.37.4 - Fix sessionid specific data not to be sent on reload/refresh
|
|
5
7
|
- v2.37.3 - Fix hang on layer change
|
|
@@ -17,7 +19,7 @@
|
|
|
17
19
|
Delete marker now also removes from heatmap layer. Issue #218
|
|
18
20
|
|
|
19
21
|
- v2.31.3 - Undo previous fix as while more technically correct - doesn't look so good. Issue #217
|
|
20
|
-
- v2.31.2
|
|
22
|
+
- v2.31.2 - Fix more antimeridian crossing wrinkles. Issue #216
|
|
21
23
|
- v2.31.1 - Fix missing type property for drawings, and pass back feedback value. Add route distance. Issue #213, Issue #212, PR #215
|
|
22
24
|
- v2.31.0 - Better handling of KML files. Issue #211
|
|
23
25
|
|
package/README.md
CHANGED
|
@@ -13,6 +13,8 @@ Feel free to [ messages that are missing a payload. Issue #229
|
|
21
23
|
- v2.37.0 - Allow fly instead of fit option when using command to move view window. (PR #225)
|
|
22
24
|
- v2.36.0 - Add edge icons for SIDC markers just off the map.
|
|
23
|
-
- v2.35.0 - Let clickable:false work for markers as well.
|
|
24
|
-
- v2.34.0 - Let icon "url" be a local fixed path. PR #223
|
|
25
|
-
- v2.33.0 - Let shapes create click event. from PR #221
|
|
26
|
-
Fix heatmap delete point bug. Issue #222
|
|
27
|
-
- v2.32.2 - Fix map split in iframe position
|
|
28
|
-
- v2.32.1 - Let command.map.heatmap replace complete heatmap array.
|
|
29
|
-
- v2.32.0 - Change || to nullish operator ?? to fix numerous dodgy assignments. Issue #219
|
|
30
|
-
Delete marker now also removes from heatmap layer. Issue #218
|
|
31
|
-
- v2.31.3 - Undo previous fix as while more technically correct - doesn't look so good. Issue #217
|
|
32
|
-
- v2.31.2 = Fix more antimeridian crossing wrinkles. Issue #216
|
|
33
|
-
- v2.31.1 - Fix missing type property for drawings, and pass back feedback value. Add route distance. Issue #213, Issue #212, PR #215
|
|
34
|
-
- v2.31.0 - Better handling of KML files. Issue #211
|
|
35
|
-
- v2.30.3 - Fix for iframe height. Issue #210
|
|
36
|
-
- v2.30.2 - Fix for bad handling of mapbox id. Issue #208
|
|
37
|
-
- v2.30.1 - Don't resend bounds if not changed. Issue #209
|
|
38
|
-
- v2.30.0 - Add show/hide ruler option. PR #206
|
|
39
25
|
|
|
40
26
|
- see [CHANGELOG](https://github.com/dceejay/RedMap/blob/master/CHANGELOG.md) for full list of changes.
|
|
41
27
|
|
|
@@ -48,7 +34,7 @@ Either use the Manage Palette option in the Node-RED Editor menu, or run the fol
|
|
|
48
34
|
## Usage
|
|
49
35
|
|
|
50
36
|
Plots "things" on a map. By default the map will be served from `{httpRoot}/worldmap`, but this
|
|
51
|
-
can be
|
|
37
|
+
can be changed in the configuration panel.
|
|
52
38
|
|
|
53
39
|
Use keyboard shortcut `⌘⇧m`, `ctrl-shift-m` to jump to the map.
|
|
54
40
|
|
|
@@ -61,13 +47,13 @@ The minimum **msg.payload** must contain `name`, `lat` and `lon` properties, for
|
|
|
61
47
|
Optional properties include
|
|
62
48
|
|
|
63
49
|
- **deleted** : set to <i>true</i> to remove the named marker. (default <i>false</i>)
|
|
64
|
-
- **draggable** : set to <i>true</i> to allow marker to be moved. (default <i>false</i>)
|
|
50
|
+
- **draggable** : set to <i>true</i> to allow marker to be moved by the mouse. (default <i>false</i>)
|
|
65
51
|
- **layer** : specify a layer on the map to add marker to. (default <i>"unknown"</i>)
|
|
66
52
|
- **track | hdg | heading | bearing** : when combined with speed, draws a vector. (only first will be used)
|
|
67
|
-
- **speed** : when combined with heading, draws a vector.
|
|
68
|
-
- **accuracy** : when combined with heading vector, draws
|
|
69
|
-
- **color** : CSS color name or #rrggbb value for heading vector line or accuracy polygon
|
|
70
|
-
- **icon** : <a href="https://fontawesome.com/v4.7.0/icons/" target="mapinfo">font awesome</a> icon name, <a href="https://github.com/Paul-Reed/weather-icons-lite" target="mapinfo">weather-lite</a> icon, :emoji name:, or https://
|
|
53
|
+
- **speed** : when combined with track, hdg, heading, or bearing, draws a leader line vector.
|
|
54
|
+
- **accuracy** : when combined with heading vector, draws an arc of possible direction.
|
|
55
|
+
- **color** : CSS color name or #rrggbb value for heading vector line or accuracy polygon.
|
|
56
|
+
- **icon** : <a href="https://fontawesome.com/v4.7.0/icons/" target="mapinfo">font awesome</a> icon name, <a href="https://github.com/Paul-Reed/weather-icons-lite" target="mapinfo">weather-lite</a> icon, :emoji name:, or https:// uri.
|
|
71
57
|
- **iconColor** : Standard CSS colour name or #rrggbb hex value.
|
|
72
58
|
- **SIDC** : NATO symbology code (can be used instead of icon). See below.
|
|
73
59
|
- **building** : OSMbulding GeoJSON feature set to add 2.5D buildings to buildings layer. See below.
|
|
@@ -96,7 +82,7 @@ If you use the name without the fa- prefix (eg `male`) you will get the icon ins
|
|
|
96
82
|
|
|
97
83
|
You can also specify an emoji as the icon by using the :emoji name: syntax - for example `:smile:`. Here is a **[list of emojis](https://github.com/dceejay/RedMap/blob/master/emojilist.md)**.
|
|
98
84
|
|
|
99
|
-
Or you can specify an image to load as an icon by setting the icon to http(s)://... By default will be scaled to 32x32 pixels. You can change the size by setting **iconSize** to a number - eg 64. Example icon - `"https://img.icons8.com/windows/32/000000/bird.png"`
|
|
85
|
+
Or you can specify an image to load as an icon by setting the icon to http(s)://... By default it will be scaled to 32x32 pixels. You can change the size by setting **iconSize** to a number - eg 64. Example icon - `"https://img.icons8.com/windows/32/000000/bird.png"`
|
|
100
86
|
|
|
101
87
|
There are also several special icons...
|
|
102
88
|
|
|
@@ -112,7 +98,7 @@ There are also several special icons...
|
|
|
112
98
|
- **satellite** : a small satellite icon.
|
|
113
99
|
- **iss** : a slightly larger icon for the ISS.
|
|
114
100
|
- **locate** : a 4 corner outline to locate a point without obscuring it.
|
|
115
|
-
- **friend** : pseudo NATO style blue rectangle. (see NATO SIDC option below)
|
|
101
|
+
- **friend** : pseudo NATO style blue rectangle. (but see NATO SIDC option below)
|
|
116
102
|
- **hostile** : pseudo NATO style red circle.
|
|
117
103
|
- **neutral** : pseudo NATO style green square.
|
|
118
104
|
- **unknown** : pseudo NATO style yellow square.
|
|
@@ -145,7 +131,8 @@ then rather than draw a point and icon it draws the polygon. If the "area" array
|
|
|
145
131
|
elements, then it assumes this is a bounding box for a rectangle and draws a rectangle.
|
|
146
132
|
|
|
147
133
|
Likewise if it contains a **line** property it will draw the polyline.
|
|
148
|
-
|
|
134
|
+
|
|
135
|
+
If the payload also includes a property `fit:true` the map will zoom to fit the line or area. Alternatively you can use `fly:true` instead of fit for a more animated look.
|
|
149
136
|
|
|
150
137
|
Finally if a **greatcircle** property is set containing an array of two coordinates then an arc
|
|
151
138
|
following the great circle between the two co-ordinates is plotted.
|
|
@@ -339,7 +326,7 @@ in addition existing male, female, fa-male and fa-female icons are all represent
|
|
|
339
326
|
|
|
340
327
|
**NOTES**
|
|
341
328
|
|
|
342
|
-
- There is currently no way to add labels, popups, or make the icons clickable.
|
|
329
|
+
- There is currently no way to add labels, popups, or to make the icons clickable.
|
|
343
330
|
- The 3D only really works at zoomed in scales 16+ due to the small size of the icons. They are not scale independent like icons on the normal map.
|
|
344
331
|
- As this uses the mapbox api you may wish to edit the index3d.html code to include your api key to remove any usage restrictions.
|
|
345
332
|
- This view is a side project to the Node-RED Worldmap project so I'm happy to take PRs but it probably won't be actively developed.
|
|
@@ -374,9 +361,9 @@ If File Drop is enabled - then the map can accept files of type gpx, kml, nvg, j
|
|
|
374
361
|
|
|
375
362
|
All actions also include a:
|
|
376
363
|
`msg._sessionid` property that indicates which client session they came from. Any msg sent out that includes this property will ONLY be sent to that session - so you can target map updates to specific sessions if required.
|
|
377
|
-
|
|
364
|
+
`msg._sessionip` property that shows the ip of the client that is connected to the session.
|
|
378
365
|
|
|
379
|
-
|
|
366
|
+
The "connected" action also include a `msg._clientheaders` property that shows the headers sent by the client to make a connection to the session.
|
|
380
367
|
|
|
381
368
|
|
|
382
369
|
### Utility functions
|
package/package.json
CHANGED
package/worldmap/worldmap.js
CHANGED
|
@@ -2795,7 +2795,7 @@ function doCommand(cmd) {
|
|
|
2795
2795
|
|
|
2796
2796
|
// handle any incoming GEOJSON directly - may style badly
|
|
2797
2797
|
function doGeojson(n,g,l,o) {
|
|
2798
|
-
//console.log("GEOJSON",n,g,l,o)
|
|
2798
|
+
// console.log("GEOJSON",n,g,l,o)
|
|
2799
2799
|
var lay = l ?? g.name ?? "unknown";
|
|
2800
2800
|
// if (!basemaps[lay]) {
|
|
2801
2801
|
var opt = { style: function(feature) {
|
|
@@ -2853,6 +2853,21 @@ function doGeojson(n,g,l,o) {
|
|
|
2853
2853
|
className: "natoicon",
|
|
2854
2854
|
});
|
|
2855
2855
|
}
|
|
2856
|
+
else if (feature.properties["marker-symbol"].substr(0,3) === "fa-") {
|
|
2857
|
+
try {
|
|
2858
|
+
var col = feature.properties["marker-color"] ?? "#910000";
|
|
2859
|
+
var imod = "";
|
|
2860
|
+
if (feature.properties["marker-symbol"].indexOf(" ") === -1) { imod = "fa-2x "; }
|
|
2861
|
+
myMarker = L.divIcon({
|
|
2862
|
+
className:"faicon",
|
|
2863
|
+
html: '<center><i class="fa fa-fw '+imod+feature.properties["marker-symbol"]+'" style="color:'+col+'"></i></center>',
|
|
2864
|
+
iconSize: [32, 32],
|
|
2865
|
+
iconAnchor: [16, 12],
|
|
2866
|
+
popupAnchor: [0, -16]
|
|
2867
|
+
});
|
|
2868
|
+
}
|
|
2869
|
+
catch(e) { console.log(e); }
|
|
2870
|
+
}
|
|
2856
2871
|
else {
|
|
2857
2872
|
myMarker = L.VectorMarkers.icon({
|
|
2858
2873
|
icon: feature.properties["marker-symbol"] ?? "circle",
|
|
@@ -2867,19 +2882,21 @@ function doGeojson(n,g,l,o) {
|
|
|
2867
2882
|
if (feature.properties.hasOwnProperty("url")) {
|
|
2868
2883
|
feature.properties.url = "<a target='_new' href='"+feature.properties.url+"'>"+feature.properties.url+"</a>";
|
|
2869
2884
|
}
|
|
2870
|
-
delete feature.properties["marker-symbol"];
|
|
2871
|
-
delete feature.properties["marker-color"];
|
|
2872
|
-
delete feature.properties["marker-size"];
|
|
2873
2885
|
var nf = {title:feature.properties.title, name:feature.properties.name};
|
|
2874
2886
|
feature.properties = Object.assign(nf, feature.properties);
|
|
2875
2887
|
return L.marker(latlng, {title:feature.properties.title ?? "", icon:myMarker});
|
|
2876
2888
|
}
|
|
2877
2889
|
opt.onEachFeature = function (f,l) {
|
|
2878
2890
|
if (f.properties && Object.keys(f.properties).length > 0) {
|
|
2879
|
-
var tx = JSON.stringify(f.properties,null,' ');
|
|
2891
|
+
var tx = JSON.parse(JSON.stringify(f.properties,null,' '));
|
|
2892
|
+
delete tx["marker-symbol"];
|
|
2893
|
+
delete tx["marker-color"];
|
|
2894
|
+
delete tx["marker-size"];
|
|
2895
|
+
tx = JSON.stringify(tx,null,' ');
|
|
2880
2896
|
if ( tx !== "{}") {
|
|
2881
|
-
l.bindPopup('<pre style="overflow-x: scroll">'+
|
|
2897
|
+
l.bindPopup('<pre style="overflow-x: scroll">'+tx.replace(/[\{\}"]/g,'')+'</pre>');
|
|
2882
2898
|
}
|
|
2899
|
+
console.log("TX",tx.replace(/[\{\}"]/g,''))
|
|
2883
2900
|
}
|
|
2884
2901
|
if (o && o.hasOwnProperty("clickable") && o.clickable === true) {
|
|
2885
2902
|
l.on('click', function (e) {
|