node-red-contrib-web-worldmap 4.3.0 → 4.3.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 +5 -2
- package/worldmap/worldmap.js +22 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
### Change Log for Node-RED Worldmap
|
|
2
2
|
|
|
3
|
+
- v4.3.2 - Fix geojson popup missing label name.
|
|
4
|
+
- v4.3.1 - Small fix to icon transparency, and routing detail.
|
|
3
5
|
- v4.3.0 - Add support for PMtiles files.
|
|
4
6
|
- v4.2.1 - Revert use of optional chaining to extend life slightly. Issue #252
|
|
5
7
|
- v4.2.0 - Let icons also be inline images data:image...
|
package/README.md
CHANGED
|
@@ -13,6 +13,8 @@ Feel free to [;
|
|
|
117
117
|
|
|
118
118
|
var handleData = function(data) {
|
|
119
119
|
if (Array.isArray(data)) {
|
|
120
|
-
//console.log("ARRAY");
|
|
120
|
+
//console.log("ARRAY:",data.length);
|
|
121
121
|
for (var prop in data) {
|
|
122
122
|
if (data[prop].command) { doCommand(data[prop].command); delete data[prop].command; }
|
|
123
123
|
if (data[prop].hasOwnProperty("name")) {
|
|
@@ -1278,7 +1278,7 @@ var addOverlays = function(overlist) {
|
|
|
1278
1278
|
return x.lng+","+x.lat;
|
|
1279
1279
|
})).join(';');
|
|
1280
1280
|
|
|
1281
|
-
fetch('https://router.project-osrm.org/route/v1/driving/'+p)
|
|
1281
|
+
fetch('https://router.project-osrm.org/route/v1/driving/'+p+'?overview=full')
|
|
1282
1282
|
.then(response => response.json())
|
|
1283
1283
|
.then(data => {
|
|
1284
1284
|
if (data.code !== "Ok") { sendDrawing(n); }
|
|
@@ -1554,15 +1554,12 @@ function setMarker(data) {
|
|
|
1554
1554
|
opt.color = opt.color ?? data.color ?? data.lineColor ?? "#910000";
|
|
1555
1555
|
opt.fillColor = opt.fillColor ?? data.fillColor ?? "#910000";
|
|
1556
1556
|
opt.stroke = opt.stroke ?? (data.hasOwnProperty("stroke")) ? data.stroke : true;
|
|
1557
|
-
opt.weight = opt.weight ?? data.weight;
|
|
1558
|
-
opt.opacity = opt.opacity ?? data.opacity;
|
|
1559
|
-
opt.fillOpacity = opt.fillOpacity ?? data.fillOpacity;
|
|
1557
|
+
opt.weight = opt.weight ?? data.weight ?? 2;
|
|
1558
|
+
opt.opacity = opt.opacity ?? data.opacity ?? 1;
|
|
1559
|
+
if (!data.SIDC) { opt.fillOpacity = opt.fillOpacity ?? data.fillOpacity ?? 0.2; }
|
|
1560
1560
|
opt.clickable = (data.hasOwnProperty("clickable")) ? data.clickable : false;
|
|
1561
1561
|
opt.fill = opt.fill ?? (data.hasOwnProperty("fill")) ? data.fill : true;
|
|
1562
1562
|
if (data.hasOwnProperty("dashArray")) { opt.dashArray = data.dashArray; }
|
|
1563
|
-
if (opt.fillOpacity === undefined) { opt.fillOpacity = 0.2; }
|
|
1564
|
-
if (opt.opacity === undefined) { opt.opacity = 1; }
|
|
1565
|
-
if (opt.weight === undefined) { opt.weight = 2; }
|
|
1566
1563
|
|
|
1567
1564
|
// Replace building
|
|
1568
1565
|
if (data.hasOwnProperty("building")) {
|
|
@@ -1719,8 +1716,16 @@ function setMarker(data) {
|
|
|
1719
1716
|
delete data.position;
|
|
1720
1717
|
ll = new L.LatLng((data.lat*1), (data.lon*1));
|
|
1721
1718
|
}
|
|
1722
|
-
else if (data.hasOwnProperty("lat") && data.hasOwnProperty("lon")) {
|
|
1723
|
-
|
|
1719
|
+
else if (data.hasOwnProperty("lat") && data.hasOwnProperty("lon")) {
|
|
1720
|
+
if (isNaN(data.lat*1)) { console.log("Invalid lat: lat:",data.lat, " - lon:",data.lon); return; }
|
|
1721
|
+
if (isNaN(data.lon*1)) { console.log("Invalid lon: lat:",data.lat, " - lon:",data.lon); return; }
|
|
1722
|
+
ll = new L.LatLng((data.lat*1), (data.lon*1));
|
|
1723
|
+
}
|
|
1724
|
+
else if (data.hasOwnProperty("latitude") && data.hasOwnProperty("longitude")) {
|
|
1725
|
+
if (isNaN(data.latitude*1)) { console.log("Invalid latitude: lat:",data.latitude, " - lon:",data.longitude); return; }
|
|
1726
|
+
if (isNaN(data.longitude*1)) { console.log("Invalid longitude: lat:",data.latitude, " - lon:",data.longitude); return; }
|
|
1727
|
+
ll = new L.LatLng((data.latitude*1), (data.longitude*1));
|
|
1728
|
+
}
|
|
1724
1729
|
else {
|
|
1725
1730
|
// console.log("No location:",data);
|
|
1726
1731
|
return;
|
|
@@ -2056,6 +2061,7 @@ function setMarker(data) {
|
|
|
2056
2061
|
});
|
|
2057
2062
|
marker = L.marker(ll, { title:data.name, icon:myicon, draggable:drag });
|
|
2058
2063
|
edgeAware();
|
|
2064
|
+
delete data.options;
|
|
2059
2065
|
}
|
|
2060
2066
|
else { // Otherwise just a generic map marker pin
|
|
2061
2067
|
myMarker = L.VectorMarkers.icon({
|
|
@@ -2130,6 +2136,7 @@ function setMarker(data) {
|
|
|
2130
2136
|
// remove items from list of properties, then add all others to popup
|
|
2131
2137
|
if (data.hasOwnProperty("options")) { delete data.options; }
|
|
2132
2138
|
if (data.hasOwnProperty("icon")) { delete data.icon; }
|
|
2139
|
+
if (data.hasOwnProperty("iconSize")) { delete data.iconSize; }
|
|
2133
2140
|
if (data.hasOwnProperty("iconColor")) { delete data.iconColor; }
|
|
2134
2141
|
if (data.hasOwnProperty("photourl")) {
|
|
2135
2142
|
words += "<img src=\"" + data.photourl + "\" style=\"max-width:100%; max-height:250px; margin-top:10px;\"><br/>";
|
|
@@ -2567,7 +2574,7 @@ function doCommand(cmd) {
|
|
|
2567
2574
|
basemaps[baselayername].addTo(map);
|
|
2568
2575
|
}
|
|
2569
2576
|
}
|
|
2570
|
-
// Add a new PMtiles/PBF feature
|
|
2577
|
+
// Add a new PMtiles/PBF feature baselayer
|
|
2571
2578
|
if (cmd.map && cmd.map.hasOwnProperty("name") && cmd.map.hasOwnProperty("pmtiles") ) {
|
|
2572
2579
|
try {
|
|
2573
2580
|
if (basemaps.hasOwnProperty(cmd.map.name)) {
|
|
@@ -2865,7 +2872,7 @@ function doCommand(cmd) {
|
|
|
2865
2872
|
if (cmd.map.hasOwnProperty("fly") && cmd.map.fly === true) { map.flyToBounds(overlays[cmd.map.overlay].getBounds()); }
|
|
2866
2873
|
else if (cmd.map.hasOwnProperty("fit") && cmd.map.fit === true) { map.fitBounds(overlays[cmd.map.overlay].getBounds()); }
|
|
2867
2874
|
}
|
|
2868
|
-
// Add a new overlay layer
|
|
2875
|
+
// Add a new leaflet (or WMS) overlay layer
|
|
2869
2876
|
if (cmd.map && cmd.map.hasOwnProperty("overlay") && cmd.map.hasOwnProperty("url") && cmd.map.hasOwnProperty("opt")) {
|
|
2870
2877
|
console.log("New overlay:",cmd.map.overlay);
|
|
2871
2878
|
if (overlays.hasOwnProperty(cmd.map.overlay)) { existsalready = true; }
|
|
@@ -3145,7 +3152,9 @@ function doGeojson(n,g,l,o) { // name, geojson, layer, options
|
|
|
3145
3152
|
delete tx["name"];
|
|
3146
3153
|
tx = JSON.stringify(tx,null,' ');
|
|
3147
3154
|
if ( tx !== "{}") {
|
|
3148
|
-
|
|
3155
|
+
var gp = '<pre style="overflow-x:scroll">'+tx.replace(/[\{\}"]/g,'')+'</pre>'
|
|
3156
|
+
if (n) { gp = '<b>'+n+'</b>' + gp; }
|
|
3157
|
+
l.bindPopup(gp);
|
|
3149
3158
|
}
|
|
3150
3159
|
}
|
|
3151
3160
|
if (o && o.hasOwnProperty("clickable") && o.clickable === true) {
|