node-red-contrib-web-worldmap 5.5.0 → 5.5.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 +2 -0
- package/README.md +8 -18
- package/package.json +1 -1
- package/worldmap/worldmap.js +13 -6
- package/worldmap.js +1 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
### Change Log for Node-RED Worldmap
|
|
2
2
|
|
|
3
|
+
- v5.5.2 - Slight improvement for on/offline choice of map
|
|
4
|
+
- v5.5.1 - Fix maxNativeZoom for pmtiles to pull from tiles files. Issue #312
|
|
3
5
|
- v5.5.0 - Add ability to load raster pmtiles files. Issue #312
|
|
4
6
|
- v5.4.0 - Let msg.payload.command.zoomLevels set an array of acceptable zoom levels. Issue #312
|
|
5
7
|
- v5.3.0 - Let msg.payload.popupOptions object set Leaflet popup options so it can be customised. Issue #311
|
package/README.md
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
# node-red-contrib-web-worldmap
|
|
2
2
|
|
|
3
|
+
A <a href="https://nodered.org" target="mapinfo">Node-RED</a> node to provide a world map web page for plotting "things" on. Please feel free to [](https://github.com/sponsors/dceejay) this project.
|
|
4
|
+
|
|
3
5
|
[](https://nodered.org)
|
|
4
6
|

|
|
5
7
|
[](https://github.com/dceejay/redmap/blob/master/LICENSE)
|
|
6
8
|
|
|
7
|
-
A <a href="https://nodered.org" target="mapinfo">Node-RED</a> node to provide a world
|
|
8
|
-
map web page for plotting "things" on.
|
|
9
|
-
|
|
10
|
-
Feel free to [](https://github.com/sponsors/dceejay) this project.
|
|
11
|
-
|
|
12
9
|

|
|
13
10
|
|
|
14
11
|
### Updates
|
|
15
12
|
|
|
13
|
+
- v5.5.2 - Slight improvement for on/offline choice of map
|
|
14
|
+
- v5.5.1 - Fix maxNativeZoom for pmtiles to pull from tiles files. Issue #312
|
|
16
15
|
- v5.5.0 - Add ability to load raster pmtiles files. Issue #312
|
|
17
16
|
- v5.4.0 - Let msg.payload.command.zoomLevels set an array of acceptable zoom levels. Issue #312
|
|
18
17
|
- v5.3.0 - Let msg.payload.popupOptions object set Leaflet popup options so it can be customised. Issue #311
|
|
@@ -23,15 +22,6 @@ Feel free to [. PR #295.
|
|
29
|
-
- v5.0.6 - Tweak SIDC flag handling slightly to show direction if available and moving.
|
|
30
|
-
- v5.0.4 - Tweak CoT handling slightly.
|
|
31
|
-
- v5.0.3 - Add great context menu example flow. PR #290. Bump express lib. PR #291.
|
|
32
|
-
- v5.0.2 - Fix sidcEdgeIcon docs PR #289.
|
|
33
|
-
- v5.0.1 - Fix isArray error PR #288.
|
|
34
|
-
- v5.0.0 - Feedback cleanup PR #281, edgeicons option PR #287, bump libs for vuln fixes.
|
|
35
25
|
|
|
36
26
|
- see [CHANGELOG](https://github.com/dceejay/RedMap/blob/master/CHANGELOG.md) for full list of changes.
|
|
37
27
|
|
|
@@ -96,6 +86,8 @@ If you use the name without the fa- prefix (eg `male`) you will get the icon ins
|
|
|
96
86
|
|
|
97
87
|
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
88
|
|
|
89
|
+
Note: Not all browsers/OS support unicode emoji - if you can see the Swiss flag here (🇨🇭) then you may be OK.
|
|
90
|
+
|
|
99
91
|
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 of pixels - eg 64. Example icon - `"https://img.icons8.com/windows/32/000000/bird.png"` or you can use an inline image of the form `data:image/...` which uses a base64 encoded image.
|
|
100
92
|
|
|
101
93
|
There are also several special icons...
|
|
@@ -142,8 +134,6 @@ There are lots of extra options you can specify as `msg.payload.options` - see t
|
|
|
142
134
|
|
|
143
135
|
Note: If the SIDC code is a 2525C 15 characters long, where chars 13 and 14 are a country code - then the country flag emoji is added to the staffComments field of the icon. If it's a 20 char 2525D code then the options:country property will be used to create the flag.
|
|
144
136
|
|
|
145
|
-
Note: Not all browsers/OS support unicode emoji - if you can see the Swiss flag here (🇨🇭) then you may be OK.
|
|
146
|
-
|
|
147
137
|
#### TAK Visualisation
|
|
148
138
|
|
|
149
139
|
Users of [TAK](https://tak.gov) can use the [TAK ingest node](https://flows.nodered.org/node/node-red-contrib-tak-registration) to create a JSON formatted TAK event object, received from a TAK server. This can be fed directly into the worldmap node.
|
|
@@ -758,14 +748,14 @@ You can set some default options for the pmtiles by creating a file called **pmt
|
|
|
758
748
|
|
|
759
749
|
{
|
|
760
750
|
"attribution": "Protomaps and OSM",
|
|
761
|
-
"
|
|
751
|
+
"maxNativeZoom": 15,
|
|
762
752
|
"maxZoom": 20,
|
|
763
753
|
"theme": "dark"
|
|
764
754
|
}
|
|
765
755
|
|
|
766
756
|
theme can be light, dark, white, black, or grayscale.
|
|
767
757
|
|
|
768
|
-
The `
|
|
758
|
+
The `maxNativeZoom` should match the maximum zoom level in you pmtiles file(s) - whereas the `maxZoom` is the leaflet maximum zoom level you want to support. `theme` can be 'light', 'dark', 'white', 'black', or 'grayscale'.
|
|
769
759
|
|
|
770
760
|
You can also load them dynamically with a command like
|
|
771
761
|
|
package/package.json
CHANGED
package/worldmap/worldmap.js
CHANGED
|
@@ -181,10 +181,15 @@ var customTopoLayer = L.geoJson(null, {clickable:false, style: {color:"blue", we
|
|
|
181
181
|
layers["_countries"] = omnivore.topojson('images/world-50m-flat.json',null,customTopoLayer);
|
|
182
182
|
overlays["countries"] = layers["_countries"];
|
|
183
183
|
|
|
184
|
-
var onoffline = function() {
|
|
185
|
-
if (
|
|
186
|
-
|
|
187
|
-
|
|
184
|
+
var onoffline = function() {
|
|
185
|
+
if (!navigator.onLine) {
|
|
186
|
+
if (pmtloaded !== "") { basemaps[pmtloaded].addTo(map); layercontrol._update(); }
|
|
187
|
+
else { map.addLayer(overlays["countries"]); }
|
|
188
|
+
}
|
|
189
|
+
else if (Object.keys(basemaps).length === 0 ) {
|
|
190
|
+
map.addLayer(overlays["countries"]);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
188
193
|
|
|
189
194
|
document.addEventListener ("keydown", function (ev) {
|
|
190
195
|
// Set Ctl-Alt-3 to switch to 3d view
|
|
@@ -2730,14 +2735,16 @@ function doCommand(cmd) {
|
|
|
2730
2735
|
const p = new pmtiles.PMTiles(cmd.map.pmtiles);
|
|
2731
2736
|
p.getHeader().then((h) => {
|
|
2732
2737
|
var opt = cmd.map.opt || {};
|
|
2733
|
-
if (!opt.
|
|
2734
|
-
opt.
|
|
2738
|
+
if (!opt.minNativeZoom) { opt.minNativeZoom = h.minZoom || 5; }
|
|
2739
|
+
if (!opt.maxNativeZoom) { opt.maxNativeZoom = h.maxZoom || 15; }
|
|
2740
|
+
opt.maxZoom = opt.maxZoom || 20;
|
|
2735
2741
|
opt.attribution = opt.attribution || '© Protomaps & OSM';
|
|
2736
2742
|
if (!opt.paintRules && !opt.labelRules && !opt.backgroundColor && !opt.theme) {
|
|
2737
2743
|
opt.theme = "light"; // light, dark, white, black, grayscale
|
|
2738
2744
|
}
|
|
2739
2745
|
if (h.tileType === 1) {
|
|
2740
2746
|
opt.url = cmd.map.pmtiles;
|
|
2747
|
+
if (!opt.maxDataZoom) { opt.maxDataZoom = h.maxZoom || 15; }
|
|
2741
2748
|
basemaps[cmd.map.name] = protomapsL.leafletLayer(opt);
|
|
2742
2749
|
}
|
|
2743
2750
|
else {
|
package/worldmap.js
CHANGED
|
@@ -131,9 +131,7 @@ module.exports = function(RED) {
|
|
|
131
131
|
client.write(JSON.stringify({command:c}));
|
|
132
132
|
for (var p=0; p < pmtiles.length; p++) {
|
|
133
133
|
fs.symlink(RED.settings.userDir+'/'+pmtiles[p], __dirname+'/worldmap/'+pmtiles[p], 'file', (err) => {
|
|
134
|
-
if (err) {
|
|
135
|
-
if (err.code !== "EEXIST") { console.log(err); }
|
|
136
|
-
}
|
|
134
|
+
if (err && err.code !== "EEXIST") { console.log(err); }
|
|
137
135
|
})
|
|
138
136
|
client.write(JSON.stringify({command: {map: {name:pmtiles[p].split('.')[0], pmtiles:pmtiles[p], opt:pmtilesopts }}}));
|
|
139
137
|
node.log("Added pmtiles file: "+pmtiles[p]);
|