diff --git a/CHANGELOG.md b/CHANGELOG.md index f0c76f6..7417710 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ### Change Log for Node-RED Worldmap + - v2.5.5 - Fix NVG import to handle symbols for points - v2.5.4 - Fix delete of hulls - v2.5.3 - Swap default satellite layer - v2.5.2 - Add boolean parameter to feedback call to allow auto close of popup on click. Set Esc key to close all open popups. Issue #146 @@ -64,7 +65,7 @@ - v1.5.26 - Ensure all map tiles loaded over https - v1.5.25 - Add button command to allow user to add and remove buttons - v1.5.24 - ensure hiderightclick does do that, and popup always has close button. Issue #69, #70 - - v1.5.23 - Let icon support use of emoji specified as :emoji name: + - v1.5.23 - Let icon support use of emoji specified as :emoji name: - v1.5.22 - Slight adjust to label positions for default map marker icon. Add .lineColor for bearing lines - v1.5.21 - Add .label option to display permanent label. Clean up some excess debug logging - v1.5.20 - Let worldmap in node send message after out node has initialised diff --git a/README.md b/README.md index 26ea030..7b9bfb9 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ map web page for plotting "things" on. ### Updates +- v2.5.5 - Fix NVG import to handle symbols for points - v2.5.4 - Fix delete of hulls - v2.5.3 - Swap default satellite layer - v2.5.2 - Add boolean parameter to feedback call to allow auto close of popup on click. Set Esc key to close all open popups. Issue #146 @@ -254,7 +255,7 @@ Other properties can be found in the leaflet documentation. ### Drawing -A single *right click* will allow you to add a point to the map - you must specify the `name` and optionally the `icon` and `layer`. +A single *right click* will allow you to add a point to the map - you must specify the `name` and optionally the `icon` and `layer`. Right-clicking on an icon will allow you to delete it. @@ -453,7 +454,7 @@ may let you markers be more visible. (see overlay example below). #### To add a minimap A minimap overview can be added by sending a suitable command. The "minimap" property -must specify the name of an existing base layer to use. The "opt" property can contain +must specify the name of an existing base layer to use. The "opt" property can contain valid options from the [minimap library options](https://github.com/Norkart/Leaflet-MiniMap#available-options). msg.payload.command.map = { @@ -534,7 +535,7 @@ Again the boolean `fit` property can be added to make the map zoom to the releva msg.payload.command.map = { "overlay": "myWind", - "velocity": { + "velocity": { "displayValues": true, "displayOptions": { "velocityType": "Global Wind", diff --git a/package.json b/package.json index 8d7935b..19501e7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-red-contrib-web-worldmap", - "version": "2.5.4", + "version": "2.5.5", "description": "A Node-RED node to provide a web page of a world map for plotting things on.", "dependencies": { "cgi": "0.3.1", diff --git a/worldmap/worldmap.js b/worldmap/worldmap.js index 8eaefb1..0062d21 100644 --- a/worldmap/worldmap.js +++ b/worldmap/worldmap.js @@ -814,7 +814,7 @@ map.on('draw:created', function (e) { if (e.layer.options.fill === false) { m.line = e.layer._latlngs; } else { m.area = e.layer._latlngs[0]; } } - + shape = {m:m, layer:e.layer}; polygons[name] = shape.layer; polygons[name].lay = "_drawing"; @@ -831,7 +831,7 @@ var sendDrawing = function(n) { map.closePopup(); shape.m.name = thing; delMarker(n,true); - + polygons[thing] = shape.layer; polygons[thing].lay = "_drawing"; polygons[thing].name = thing; @@ -1806,7 +1806,7 @@ function doCommand(cmd) { else { console.log("Invalid base layer for minimap:",cmd.map.minimap); } - + } // Remove one or more map layers (base or overlay) if (cmd.map && cmd.map.hasOwnProperty("delete")) { @@ -1897,6 +1897,37 @@ function doCommand(cmd) { } } return st; + }, + pointToLayer: function (feature, latlng) { + if (feature.hasOwnProperty("properties") && feature.properties.hasOwnProperty('symbol')) { + var sidc = feature.properties.symbol.toUpperCase().replace("APP6A:",'')//.substr(0,13); + var country; + if (sidc.length > 12) { country = sidc.substr(12).replace(/-/g,''); sidc = sidc.substr(0,12); } + myMarker = new ms.Symbol( sidc, { + uniqueDesignation:feature.properties.label, + country:country, + direction:feature.properties.course, + additionalInformation:feature.properties.modifier, + size:24 + }); + var myicon = L.icon({ + iconUrl: myMarker.toDataURL(), + iconAnchor: [myMarker.getAnchor().x, myMarker.getAnchor().y], + className: "natoicon", + }); + return L.marker(latlng, { name:feature.properties.label, icon:myicon }); + } + else { + var geojsonMarkerOptions = { + radius: 10, + fillColor: "#ff7800", + color: "#000", + weight: 1, + opacity: 1, + fillOpacity: 0.8 + }; + return L.circleMarker(latlng, geojsonMarkerOptions); + } } }); if (!existsalready) { @@ -2165,7 +2196,7 @@ function doGeojson(n,g,l,o) { markers[n].lay = lay; if (typeof layers[lay] == "undefined") { // add layer if if doesn't exist layers[lay] = new L.LayerGroup(); - overlays[lay] = layers[lay]; + overlays[lay] = layers[lay]; layercontrol.addOverlay(overlays[lay],lay); } layers[lay].addLayer(markers[n]);