node-red-contrib-web-worldmap 2.42.1 → 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 +1 -0
- package/README.md +1 -0
- package/package.json +1 -1
- package/worldmap/leaflet/leaflet-kmz.js +29 -8
- package/worldmap/worldmap.js +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
### Change Log for Node-RED Worldmap
|
|
2
2
|
|
|
3
|
+
- v2.42.2 - More KML and GEOJson drag drop fixes
|
|
3
4
|
- v2.42.1 - Remove extraneous debug logging, fix KMZ icons
|
|
4
5
|
- v2.42.0 - Add handling for TAK type spots, waypoints, alerts, sensors. Better KML/KMZ handling.
|
|
5
6
|
- v2.41.0 - Bump leaflet libs to latest stable (1.9.4)
|
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@ Feel free to [
|
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) {
|
|
@@ -265,6 +268,7 @@
|
|
|
265
268
|
// TODO: handle L.svg renderer within the L.KMZMarker class?
|
|
266
269
|
},
|
|
267
270
|
style: (feature) => {
|
|
271
|
+
// console.log("FEATSTYLE",feature)
|
|
268
272
|
var styles = {};
|
|
269
273
|
var prop = feature.properties;
|
|
270
274
|
|
|
@@ -289,16 +293,18 @@
|
|
|
289
293
|
return styles;
|
|
290
294
|
},
|
|
291
295
|
onEachFeature: (feature, layer) => {
|
|
292
|
-
|
|
296
|
+
// console.log("POP",feature.properties)
|
|
297
|
+
//if (!this.options.ballon) return;
|
|
293
298
|
|
|
294
299
|
var prop = feature.properties;
|
|
295
|
-
var name = prop.name || "";
|
|
296
|
-
var desc = prop.description || "";
|
|
300
|
+
var name = (prop.name || "").trim();
|
|
301
|
+
var desc = (prop.description || "").trim();
|
|
297
302
|
|
|
303
|
+
var p = '<div>';
|
|
298
304
|
if (name || desc) {
|
|
299
|
-
if (this.options.bindPopup) {
|
|
300
|
-
|
|
301
|
-
}
|
|
305
|
+
// if (this.options.bindPopup) {
|
|
306
|
+
// p += '<b>' + name + '</b>' + '<br>' + desc + '</div>';
|
|
307
|
+
// }
|
|
302
308
|
if (this.options.bindTooltip) {
|
|
303
309
|
layer.bindTooltip('<b>' + name + '</b>', {
|
|
304
310
|
direction: 'auto',
|
|
@@ -306,6 +312,22 @@
|
|
|
306
312
|
});
|
|
307
313
|
}
|
|
308
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
|
+
}
|
|
309
331
|
},
|
|
310
332
|
interactive: this.options.interactive,
|
|
311
333
|
});
|
|
@@ -426,5 +448,4 @@
|
|
|
426
448
|
|
|
427
449
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
428
450
|
|
|
429
|
-
})));
|
|
430
|
-
//# 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);
|
|
@@ -2874,7 +2878,7 @@ function doCommand(cmd) {
|
|
|
2874
2878
|
|
|
2875
2879
|
// handle any incoming GEOJSON directly - may style badly
|
|
2876
2880
|
function doGeojson(n,g,l,o) {
|
|
2877
|
-
// console.log("GEOJSON",n,g,l,o)
|
|
2881
|
+
// console.log("GEOJSON",n,g,l,o) // name,geojson,layer,options
|
|
2878
2882
|
var lay = l ?? g.name ?? "unknown";
|
|
2879
2883
|
// if (!basemaps[lay]) {
|
|
2880
2884
|
var opt = { style: function(feature) {
|