add more routing detail, and fix SIDC transparency issue

bump to 4.3.1
This commit is contained in:
Dave Conway-Jones 2023-11-08 11:05:47 +00:00
parent 2b0d27d40e
commit ceb80e47d9
No known key found for this signature in database
GPG Key ID: 1DDB0E91A28C2643
4 changed files with 14 additions and 11 deletions

View File

@ -1,5 +1,6 @@
### Change Log for Node-RED Worldmap ### Change Log for Node-RED Worldmap
- v4.3.1 - Small fix to icon transparency, and routing detail.
- v4.3.0 - Add support for PMtiles files. - v4.3.0 - Add support for PMtiles files.
- v4.2.1 - Revert use of optional chaining to extend life slightly. Issue #252 - v4.2.1 - Revert use of optional chaining to extend life slightly. Issue #252
- v4.2.0 - Let icons also be inline images data:image... - v4.2.0 - Let icons also be inline images data:image...

View File

@ -13,6 +13,7 @@ Feel free to [![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%
### Updates ### Updates
- v4.3.1 - Small fix to icon transparency, and routing detail.
- v4.3.0 - Add support for PMtiles files. - v4.3.0 - Add support for PMtiles files.
- v4.2.1 - Revert use of optional chaining to extend life slightly. Issue #252 - v4.2.1 - Revert use of optional chaining to extend life slightly. Issue #252
- v4.2.0 - Let icons also be inline images data:image... - v4.2.0 - Let icons also be inline images data:image...

View File

@ -1,6 +1,6 @@
{ {
"name": "node-red-contrib-web-worldmap", "name": "node-red-contrib-web-worldmap",
"version": "4.3.0", "version": "4.3.1",
"description": "A Node-RED node to provide a web page of a world map for plotting things on.", "description": "A Node-RED node to provide a web page of a world map for plotting things on.",
"dependencies": { "dependencies": {
"@turf/bezier-spline": "~6.5.0", "@turf/bezier-spline": "~6.5.0",
@ -25,7 +25,10 @@
"node-red", "node-red",
"map", "map",
"world", "world",
"tak" "tak",
"pmtiles",
"esri",
"gis"
], ],
"node-red": { "node-red": {
"version": ">=2.0.0", "version": ">=2.0.0",

View File

@ -1278,7 +1278,7 @@ var addOverlays = function(overlist) {
return x.lng+","+x.lat; return x.lng+","+x.lat;
})).join(';'); })).join(';');
fetch('https://router.project-osrm.org/route/v1/driving/'+p) fetch('https://router.project-osrm.org/route/v1/driving/'+p+'?overview=full')
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
if (data.code !== "Ok") { sendDrawing(n); } if (data.code !== "Ok") { sendDrawing(n); }
@ -1554,15 +1554,12 @@ function setMarker(data) {
opt.color = opt.color ?? data.color ?? data.lineColor ?? "#910000"; opt.color = opt.color ?? data.color ?? data.lineColor ?? "#910000";
opt.fillColor = opt.fillColor ?? data.fillColor ?? "#910000"; opt.fillColor = opt.fillColor ?? data.fillColor ?? "#910000";
opt.stroke = opt.stroke ?? (data.hasOwnProperty("stroke")) ? data.stroke : true; opt.stroke = opt.stroke ?? (data.hasOwnProperty("stroke")) ? data.stroke : true;
opt.weight = opt.weight ?? data.weight; opt.weight = opt.weight ?? data.weight ?? 2;
opt.opacity = opt.opacity ?? data.opacity; opt.opacity = opt.opacity ?? data.opacity ?? 1;
opt.fillOpacity = opt.fillOpacity ?? data.fillOpacity; if (!data.SIDC) { opt.fillOpacity = opt.fillOpacity ?? data.fillOpacity ?? 0.2; }
opt.clickable = (data.hasOwnProperty("clickable")) ? data.clickable : false; opt.clickable = (data.hasOwnProperty("clickable")) ? data.clickable : false;
opt.fill = opt.fill ?? (data.hasOwnProperty("fill")) ? data.fill : true; opt.fill = opt.fill ?? (data.hasOwnProperty("fill")) ? data.fill : true;
if (data.hasOwnProperty("dashArray")) { opt.dashArray = data.dashArray; } if (data.hasOwnProperty("dashArray")) { opt.dashArray = data.dashArray; }
if (opt.fillOpacity === undefined) { opt.fillOpacity = 0.2; }
if (opt.opacity === undefined) { opt.opacity = 1; }
if (opt.weight === undefined) { opt.weight = 2; }
// Replace building // Replace building
if (data.hasOwnProperty("building")) { if (data.hasOwnProperty("building")) {
@ -2056,6 +2053,7 @@ function setMarker(data) {
}); });
marker = L.marker(ll, { title:data.name, icon:myicon, draggable:drag }); marker = L.marker(ll, { title:data.name, icon:myicon, draggable:drag });
edgeAware(); edgeAware();
delete data.options;
} }
else { // Otherwise just a generic map marker pin else { // Otherwise just a generic map marker pin
myMarker = L.VectorMarkers.icon({ myMarker = L.VectorMarkers.icon({
@ -2567,7 +2565,7 @@ function doCommand(cmd) {
basemaps[baselayername].addTo(map); basemaps[baselayername].addTo(map);
} }
} }
// Add a new PMtiles/PBF feature layer // Add a new PMtiles/PBF feature baselayer
if (cmd.map && cmd.map.hasOwnProperty("name") && cmd.map.hasOwnProperty("pmtiles") ) { if (cmd.map && cmd.map.hasOwnProperty("name") && cmd.map.hasOwnProperty("pmtiles") ) {
try { try {
if (basemaps.hasOwnProperty(cmd.map.name)) { if (basemaps.hasOwnProperty(cmd.map.name)) {
@ -2865,7 +2863,7 @@ function doCommand(cmd) {
if (cmd.map.hasOwnProperty("fly") && cmd.map.fly === true) { map.flyToBounds(overlays[cmd.map.overlay].getBounds()); } if (cmd.map.hasOwnProperty("fly") && cmd.map.fly === true) { map.flyToBounds(overlays[cmd.map.overlay].getBounds()); }
else if (cmd.map.hasOwnProperty("fit") && cmd.map.fit === true) { map.fitBounds(overlays[cmd.map.overlay].getBounds()); } else if (cmd.map.hasOwnProperty("fit") && cmd.map.fit === true) { map.fitBounds(overlays[cmd.map.overlay].getBounds()); }
} }
// Add a new overlay layer // Add a new leaflet (or WMS) overlay layer
if (cmd.map && cmd.map.hasOwnProperty("overlay") && cmd.map.hasOwnProperty("url") && cmd.map.hasOwnProperty("opt")) { if (cmd.map && cmd.map.hasOwnProperty("overlay") && cmd.map.hasOwnProperty("url") && cmd.map.hasOwnProperty("opt")) {
console.log("New overlay:",cmd.map.overlay); console.log("New overlay:",cmd.map.overlay);
if (overlays.hasOwnProperty(cmd.map.overlay)) { existsalready = true; } if (overlays.hasOwnProperty(cmd.map.overlay)) { existsalready = true; }