From e1d8734c1cd701245d37246075eb2bdcbc2eca08 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Sat, 4 Mar 2017 14:13:05 +0000 Subject: [PATCH] Add heatmap options to control message options to close #10 --- README.md | 4 +++- package.json | 6 +++--- worldmap.html | 1 + worldmap/index.html | 5 +++++ worldmap/worldmap.appcache | 2 +- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 59e9c3e..79ef989 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ map web page for plotting "things" on. ![Map Image](https://dceejay.github.io/pages/images/redmap.png) ### Changes + - v1.0.23 - Add msg.payload.command.heatmap to allow setting of heatmap config. - v1.0.22 - Add example how to embed into Node-RED-Dashboard template. - v1.0.21 - If you specify range and icon then you get a marker and a range circle, if you just specify range with no icon, you just get a circle, and vice versa. - v1.0.20 - Add buildings overlay. @@ -23,7 +24,7 @@ map web page for plotting "things" on. Run the following command in your Node-RED user directory - typically `~/.node-red` - npm install node-red-contrib-web-worldmap + npm i --save node-red-contrib-web-worldmap ### Usage @@ -111,6 +112,7 @@ Optional properties include - **name** - name of the map base layer OR **overlay** - name of overlay layer - **url** - url of the map layer - **opt** - options object for the new layer + - **heatmap** - set heatmap options object see https://github.com/Leaflet/Leaflet.heat#reference #### For example diff --git a/package.json b/package.json index d4fb86f..1b15e3a 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { "name" : "node-red-contrib-web-worldmap", - "version" : "1.0.21", + "version" : "1.0.23", "description" : "A Node-RED node to provide a web page of a world map for plotting things on.", "dependencies" : { - "express": "4.*", - "socket.io": "^1.4.6" + "express": "^4.15.0", + "socket.io": "^1.7.3" }, "repository" : { "type":"git", diff --git a/worldmap.html b/worldmap.html index 2b9846c..15f6ac6 100644 --- a/worldmap.html +++ b/worldmap.html @@ -117,6 +117,7 @@ }, info: function() { return 'The map can be found [here]('+RED.settings.httpNodeRoot.slice(0,-1)+'/worldmap).'; + //return 'The map can be found here.'; }, oneditprepare: function() { $( "#node-input-zoom" ).spinner({min:0, max:18}); diff --git a/worldmap/index.html b/worldmap/index.html index 1b4ec03..6aa480e 100644 --- a/worldmap/index.html +++ b/worldmap/index.html @@ -619,6 +619,7 @@ overlays["day/night"] = layers["_daynight"]; var heat = L.heatLayer([], {radius:60, gradient:{0.2:'blue', 0.4:'lime', 0.6:'red', 0.8:'yellow', 1:'white'}}); layers["heat"] = new L.LayerGroup().addLayer(heat); overlays["heatmap"] = layers["heat"]; +console.log("HEAT",heat); // Add the drawing layer for fun... layers["drawing"] = new L.FeatureGroup(); @@ -1006,6 +1007,10 @@ function doCommand(cmd) { document.getElementById("maxage").value = cmd.maxage; setMaxAge(); } + if (cmd.hasOwnProperty("heatmap")) { + heat.setOptions(cmd.heatmap); + heat.redraw(); + } map.setView([clat,clon],czoom); } diff --git a/worldmap/worldmap.appcache b/worldmap/worldmap.appcache index a935106..bc9da4b 100644 --- a/worldmap/worldmap.appcache +++ b/worldmap/worldmap.appcache @@ -1,5 +1,5 @@ CACHE MANIFEST -# date: Nov 22nd v1.0.22 +# date: Mar 4th 2017 - v1.0.23 CACHE: index.html