let clear heatmap command clear heatmap...

to address Issue #170
This commit is contained in:
Dave Conway-Jones 2021-06-25 15:38:34 +01:00
parent 2c38c62bd9
commit 2335e7ed9a
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
5 changed files with 27 additions and 196 deletions

View File

@ -1,5 +1,6 @@
### Change Log for Node-RED Worldmap ### Change Log for Node-RED Worldmap
- v2.15.4 - Let clear heatmap command do what it says.
- v2.15.3 - Fix panit command to work, try to use alt units, popup alignments. - v2.15.3 - Fix panit command to work, try to use alt units, popup alignments.
- v2.15.0 - let speed be text and specify units if required (kt,kn,knots,mph,kmh,kph) default m/s. - v2.15.0 - let speed be text and specify units if required (kt,kn,knots,mph,kmh,kph) default m/s.
- v2.14.0 - Let geojson features be clickable if added as overlay. - v2.14.0 - Let geojson features be clickable if added as overlay.

View File

@ -11,6 +11,7 @@ map web page for plotting "things" on.
### Updates ### Updates
- v2.15.4 - Let clear heatmap command do what it says.
- v2.15.3 - Fix panit command to work, try to use alt units, popup alignments. - v2.15.3 - Fix panit command to work, try to use alt units, popup alignments.
- v2.15.0 - let speed be text and specify units if required (kt,kn,knots,mph,kmh,kph) default m/s. - v2.15.0 - let speed be text and specify units if required (kt,kn,knots,mph,kmh,kph) default m/s.
- v2.14.0 - Let geojson features be clickable if added as overlay. - v2.14.0 - Let geojson features be clickable if added as overlay.

View File

@ -1,177 +1 @@
[ [{"id":"1714967f.e691ea","type":"inject","z":"64eed394.c7935c","name":"","repeat":"","crontab":"","once":false,"onceDelay":"","topic":"","payload":"","payloadType":"str","x":180,"y":800,"wires":[["1b24ad2f.198453"]]},{"id":"1b24ad2f.198453","type":"function","z":"64eed394.c7935c","name":"","func":"// create random position\nvar lat = 51 + Math.random() * 0.2;\nvar lon = -1.45 + Math.random() * 0.2;\nmsg.payload={\n lat:lat, \n lon:lon, \n name:\"Mike\", \n icon:\"male\", \n color:\"#000\"};\nreturn msg;","outputs":1,"noerr":0,"x":360,"y":860,"wires":[["de5c4044.d4e0f","e0ec963913cbf7a9"]]},{"id":"de3a90c8.8179c","type":"ui_button","z":"64eed394.c7935c","name":"","group":"cd81d08b.eebb3","order":0,"width":0,"height":0,"passthru":false,"label":"Move Mike","tooltip":"","color":"","bgcolor":"","icon":"fa-male","payload":"","payloadType":"str","topic":"","topicType":"str","x":180,"y":860,"wires":[["1b24ad2f.198453"]]},{"id":"223f301c.54ea9","type":"comment","z":"64eed394.c7935c","name":"How to embed Map in Dashboard","info":"This example shows how to embed the Worldmap \nwithin the `node-red-dashboard`\n\nThe flow creates a dashboard button that \ngenerates a randon position, with the required \nicon, and passes that to the worldmap. The\nmap is configured to automatically pan to the\nposition of any point that arrives.\n","x":230,"y":740,"wires":[]},{"id":"de5c4044.d4e0f","type":"worldmap-tracks","z":"64eed394.c7935c","name":"","depth":"5","layer":"combined","x":500,"y":820,"wires":[["e0ec963913cbf7a9"]]},{"id":"e0ec963913cbf7a9","type":"ui_worldmap","z":"64eed394.c7935c","group":"cd81d08b.eebb3","order":4,"width":0,"height":0,"name":"","lat":"","lon":"","zoom":"","layer":"","cluster":"","maxage":"","usermenu":"hide","layers":"hide","panit":"true","panlock":"false","zoomlock":"false","hiderightclick":"true","coords":"none","showgrid":"true","allowFileDrop":"false","path":"/worldmap","x":660,"y":860,"wires":[]},{"id":"cd81d08b.eebb3","type":"ui_group","z":"64eed394.c7935c","name":"Default","tab":"b34078e6.e60df8","order":1,"disp":true,"width":"6"},{"id":"b34078e6.e60df8","type":"ui_tab","z":"64eed394.c7935c","name":"Home","icon":"dashboard"}]
{
"id": "9b2a29cc.3c53a8",
"type": "worldmap",
"z": "f59603d8.0a6a",
"name": "",
"lat": "",
"lon": "",
"zoom": "",
"layer": "OSM",
"cluster": "",
"maxage": "",
"usermenu": "hide",
"panit": "true",
"x": 750,
"y": 420,
"wires": []
},
{
"id": "1714967f.e691ea",
"type": "inject",
"z": "f59603d8.0a6a",
"name": "",
"topic": "",
"payload": "",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 290,
"y": 360,
"wires": [
[
"1b24ad2f.198453"
]
]
},
{
"id": "1b24ad2f.198453",
"type": "function",
"z": "f59603d8.0a6a",
"name": "",
"func": "// create random position\nvar lat = 51 + Math.random() * 0.2;\nvar lon = -1.45 + Math.random() * 0.2;\nmsg.payload={\n lat:lat, \n lon:lon, \n name:\"Mike\", \n icon:\"male\", \n color:\"#000\"};\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 470,
"y": 420,
"wires": [
[
"9b2a29cc.3c53a8",
"de5c4044.d4e0f"
]
]
},
{
"id": "5af27cae.299144",
"type": "inject",
"z": "f59603d8.0a6a",
"name": "",
"topic": "",
"payload": "",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": "",
"x": 270,
"y": 480,
"wires": [
[
"f1be23c1.dd096"
]
]
},
{
"id": "4bab3415.afdf9c",
"type": "ui_template",
"z": "f59603d8.0a6a",
"group": "cd81d08b.eebb3",
"name": "",
"order": 0,
"width": "6",
"height": "6",
"format": "<div ng-bind-html=\"msg.payload | trusted\"></div>",
"storeOutMessages": true,
"fwdInMessages": true,
"templateScope": "local",
"x": 640,
"y": 480,
"wires": [
[]
]
},
{
"id": "f1be23c1.dd096",
"type": "template",
"z": "f59603d8.0a6a",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "<iframe src=\"../worldmap\" height=300px ></iframe>",
"x": 470,
"y": 480,
"wires": [
[
"4bab3415.afdf9c"
]
]
},
{
"id": "de3a90c8.8179c",
"type": "ui_button",
"z": "f59603d8.0a6a",
"name": "",
"group": "cd81d08b.eebb3",
"order": 0,
"width": 0,
"height": 0,
"label": "Move Mike",
"color": "",
"icon": "fa-male",
"payload": "",
"payloadType": "str",
"topic": "",
"x": 290,
"y": 420,
"wires": [
[
"1b24ad2f.198453"
]
]
},
{
"id": "223f301c.54ea9",
"type": "comment",
"z": "f59603d8.0a6a",
"name": "How to embed Map in Dashboard",
"info": "This example shows how to embed the Worldmap \ninto a template node within the `node-red-dashboard`\n\nThe first flow creates a dashboard button that \ngenerates a randon position, with the required \nicon, and passes that to the worldmap. The\nmap is configured to automatically pan to the\nposition of any point that arrives.\n\nThe second flow initialise the dashboard template\nwith the initial map and sets it to a more square shape\nby adjusting the height.",
"x": 340,
"y": 300,
"wires": []
},
{
"id": "de5c4044.d4e0f",
"type": "worldmap-tracks",
"z": "f59603d8.0a6a",
"name": "",
"depth": "5",
"layer": "combined",
"x": 610,
"y": 380,
"wires": [
[
"9b2a29cc.3c53a8"
]
]
},
{
"id": "cd81d08b.eebb3",
"type": "ui_group",
"z": "f59603d8.0a6a",
"name": "Default",
"tab": "b34078e6.e60df8",
"disp": true,
"width": "6"
},
{
"id": "b34078e6.e60df8",
"type": "ui_tab",
"z": "f59603d8.0a6a",
"name": "Home",
"icon": "dashboard"
}
]

View File

@ -1,6 +1,6 @@
{ {
"name": "node-red-contrib-web-worldmap", "name": "node-red-contrib-web-worldmap",
"version": "2.15.3", "version": "2.15.4",
"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": {
"cgi": "0.3.1", "cgi": "0.3.1",

View File

@ -385,6 +385,10 @@ function doLock(v) {
// Remove old markers // Remove old markers
function doTidyUp(l) { function doTidyUp(l) {
if (l === "heatmap") {
heat.setLatLngs([]);
}
else {
var d = parseInt(Date.now()/1000); var d = parseInt(Date.now()/1000);
for (var m in markers) { for (var m in markers) {
if ((l && (l == markers[m].lay)) || typeof markers[m].ts != "undefined") { if ((l && (l == markers[m].lay)) || typeof markers[m].ts != "undefined") {
@ -407,6 +411,7 @@ function doTidyUp(l) {
if (layers[l]) { map.removeLayer(layers[l]); layercontrol.removeLayer(layers[l]); delete layers[l]; } if (layers[l]) { map.removeLayer(layers[l]); layercontrol.removeLayer(layers[l]); delete layers[l]; }
if (overlays[l]) { map.removeLayer(overlays[l]); layercontrol.removeLayer(overlays[l]); delete overlays[l]; } if (overlays[l]) { map.removeLayer(overlays[l]); layercontrol.removeLayer(overlays[l]); delete overlays[l]; }
} }
}
} }
// Call tidyup every {maxage} seconds - default 10 mins // Call tidyup every {maxage} seconds - default 10 mins