node-red-contrib-web-worldmap 2.42.0 → 2.42.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 +2 -0
- package/package.json +1 -1
- package/worldmap/leaflet/leaflet-kmz.js +30 -10
- package/worldmap/worldmap.js +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
### Change Log for Node-RED Worldmap
|
|
2
2
|
|
|
3
|
+
- v2.42.2 - More KML and GEOJson drag drop fixes
|
|
4
|
+
- v2.42.1 - Remove extraneous debug logging, fix KMZ icons
|
|
3
5
|
- v2.42.0 - Add handling for TAK type spots, waypoints, alerts, sensors. Better KML/KMZ handling.
|
|
4
6
|
- v2.41.0 - Bump leaflet libs to latest stable (1.9.4)
|
|
5
7
|
- v2.40.1 - Fix missing countries overlay when starting disconnected.
|
package/README.md
CHANGED
|
@@ -13,6 +13,8 @@ Feel free to [
|
|
18
20
|
- v2.40.1 - Fix missing countries overlay when starting disconnected.
|
package/package.json
CHANGED
|
@@ -140,6 +140,9 @@
|
|
|
140
140
|
text = new TextDecoder(encoding[1]).decode(data);
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
+
else {
|
|
144
|
+
text = text.substr(text.indexOf('<'));
|
|
145
|
+
}
|
|
143
146
|
return text ? (new DOMParser()).parseFromString(text, 'text/xml') : document.implementation.createDocument(null, "kml");}
|
|
144
147
|
|
|
145
148
|
function unzip(folder) {
|
|
@@ -246,7 +249,6 @@
|
|
|
246
249
|
iconAnchor: [14, 14],
|
|
247
250
|
})
|
|
248
251
|
if (feature.properties && feature.properties.SymbolSpecification) {
|
|
249
|
-
console.log("DING",feature.properties.SymbolSpecification)
|
|
250
252
|
var mysymbol = new ms.Symbol(feature.properties.SymbolSpecification.split(':')[1]);
|
|
251
253
|
mysymbol = mysymbol.setOptions({ size:20 });
|
|
252
254
|
kicon = L.icon({
|
|
@@ -254,7 +256,7 @@
|
|
|
254
256
|
iconAnchor: [mysymbol.getAnchor().x, mysymbol.getAnchor().y],
|
|
255
257
|
});
|
|
256
258
|
}
|
|
257
|
-
if (kicon.iconUrl === undefined) { // No icon found so just use default marker.
|
|
259
|
+
if (kicon.options.iconUrl === undefined) { // No icon found so just use default marker.
|
|
258
260
|
return L.marker(latlng);
|
|
259
261
|
}
|
|
260
262
|
else {
|
|
@@ -266,6 +268,7 @@
|
|
|
266
268
|
// TODO: handle L.svg renderer within the L.KMZMarker class?
|
|
267
269
|
},
|
|
268
270
|
style: (feature) => {
|
|
271
|
+
// console.log("FEATSTYLE",feature)
|
|
269
272
|
var styles = {};
|
|
270
273
|
var prop = feature.properties;
|
|
271
274
|
|
|
@@ -290,16 +293,18 @@
|
|
|
290
293
|
return styles;
|
|
291
294
|
},
|
|
292
295
|
onEachFeature: (feature, layer) => {
|
|
293
|
-
|
|
296
|
+
// console.log("POP",feature.properties)
|
|
297
|
+
//if (!this.options.ballon) return;
|
|
294
298
|
|
|
295
299
|
var prop = feature.properties;
|
|
296
|
-
var name = prop.name || "";
|
|
297
|
-
var desc = prop.description || "";
|
|
300
|
+
var name = (prop.name || "").trim();
|
|
301
|
+
var desc = (prop.description || "").trim();
|
|
298
302
|
|
|
303
|
+
var p = '<div>';
|
|
299
304
|
if (name || desc) {
|
|
300
|
-
if (this.options.bindPopup) {
|
|
301
|
-
|
|
302
|
-
}
|
|
305
|
+
// if (this.options.bindPopup) {
|
|
306
|
+
// p += '<b>' + name + '</b>' + '<br>' + desc + '</div>';
|
|
307
|
+
// }
|
|
303
308
|
if (this.options.bindTooltip) {
|
|
304
309
|
layer.bindTooltip('<b>' + name + '</b>', {
|
|
305
310
|
direction: 'auto',
|
|
@@ -307,6 +312,22 @@
|
|
|
307
312
|
});
|
|
308
313
|
}
|
|
309
314
|
}
|
|
315
|
+
|
|
316
|
+
var u = {};
|
|
317
|
+
if (prop.FeaturePlatformId) { u.FeaturePlatformId = prop.FeaturePlatformId; }
|
|
318
|
+
if (prop.FeatureAddress) { u.FeatureAddress = prop.FeatureAddress; }
|
|
319
|
+
if (prop.SymbolSpecification) { u.Symbol = prop.SymbolSpecification; }
|
|
320
|
+
if (prop.Speed) { u.Speed = prop.Speed; }
|
|
321
|
+
if (prop.FeatureLastModified) { u.LastUpdate = prop.FeatureLastModified; }
|
|
322
|
+
if (u.LastUpdate) { u.LastUpdate = (new Date(u.LastUpdate*1000)).toISOString(); }
|
|
323
|
+
|
|
324
|
+
Object.entries(u).forEach(([key, value]) => {
|
|
325
|
+
p += '<b>'+key+'</b> : '+value+'<br/>';
|
|
326
|
+
});
|
|
327
|
+
p += '</div>';
|
|
328
|
+
if (p !== '<div></div>') {
|
|
329
|
+
layer.bindPopup(p);
|
|
330
|
+
}
|
|
310
331
|
},
|
|
311
332
|
interactive: this.options.interactive,
|
|
312
333
|
});
|
|
@@ -427,5 +448,4 @@
|
|
|
427
448
|
|
|
428
449
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
429
450
|
|
|
430
|
-
})));
|
|
431
|
-
//# sourceMappingURL=leaflet-kmz-src.js.map
|
|
451
|
+
})));
|
package/worldmap/worldmap.js
CHANGED
|
@@ -257,6 +257,10 @@ var readFile = function(file) {
|
|
|
257
257
|
console.log("ZIP FILE",file);
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
+
else if (file.type.indexOf('geo+json') !== -1 ) {
|
|
261
|
+
data = JSON.parse(data);
|
|
262
|
+
doGeojson(file.name,data,"geojson");
|
|
263
|
+
}
|
|
260
264
|
else {
|
|
261
265
|
try {
|
|
262
266
|
data = JSON.parse(data);
|
|
@@ -2651,7 +2655,6 @@ function doCommand(cmd) {
|
|
|
2651
2655
|
});
|
|
2652
2656
|
let arr;
|
|
2653
2657
|
if (cmd.map.hasOwnProperty("kmz")) {
|
|
2654
|
-
console.log("KMZ",typeof cmd.map.kmz)
|
|
2655
2658
|
if (typeof cmd.map.kmz === "string") {
|
|
2656
2659
|
arr = new Uint8Array(cmd.map.kmz.length);
|
|
2657
2660
|
for (let i=0; i<cmd.map.kmz.length; i++) {
|
|
@@ -2875,7 +2878,7 @@ function doCommand(cmd) {
|
|
|
2875
2878
|
|
|
2876
2879
|
// handle any incoming GEOJSON directly - may style badly
|
|
2877
2880
|
function doGeojson(n,g,l,o) {
|
|
2878
|
-
// console.log("GEOJSON",n,g,l,o)
|
|
2881
|
+
// console.log("GEOJSON",n,g,l,o) // name,geojson,layer,options
|
|
2879
2882
|
var lay = l ?? g.name ?? "unknown";
|
|
2880
2883
|
// if (!basemaps[lay]) {
|
|
2881
2884
|
var opt = { style: function(feature) {
|