. This flow get data, create a map and drawing track. A disadvantage is: This node does
not have time updated data. Below is flows to receive data and display
on map. You need to edit worldmap node to choose the right layout for
Dashboard UI
Show/Hide Flow
[{"id":"daf21f1.bb4216","type":"http in","z":"b18b632d.3d3d7","name":"Get
Location","url":"/location","method":"post","upload":false,"swaggerDoc":"","x":850,"y":280,"wires":[["864b8ed5.23895","b821bdc5.79e3b8","3ea4a01c.95db1","1171c34e.bf7a5d","a629b170.04075","a97d3011.97edc"]]},{"id":"b821bdc5.79e3b8","type":"debug","z":"b18b632d.3d3d7","name":"Debug
Location","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1440,"y":220,"wires":[]},{"id":"864b8ed5.23895","type":"http
response","z":"b18b632d.3d3d7","name":"","statusCode":"","headers":{"content-type":"text/html"},"x":1050,"y":380,"wires":[]},{"id":"ae1febbf.8be69","type":"ui_ui_control","z":"b18b632d.3d3d7","name":"When
connect","events":"connect","x":1060,"y":460,"wires":[["b821bdc5.79e3b8","4de4747f.f005c4"]]},{"id":"4de4747f.f005c4","type":"switch","z":"b18b632d.3d3d7","name":"=true","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"connect","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1170,"y":500,"wires":[["bb80be63.25387"]]},{"id":"39b220f6.aa27c8","type":"json","z":"b18b632d.3d3d7","name":"","property":"payload","action":"","pretty":false,"x":1250,"y":140,"wires":[["1171c34e.bf7a5d","a629b170.04075"]]},{"id":"3ea4a01c.95db1","type":"function","z":"b18b632d.3d3d7","name":"Save
Latest Location","func":"//global.set('pos',[])\nvar currentLoc = global.get('pos')
|| [];\n\n//Save Location history, for other usage\nvar locHistory =
global.get('locHistory') || [];\nlocHistory.push(msg.payload[0])\nif(locHistory.length
> 500){ //Maxium location saved\n locHistory.shift();\n}\n\n//Search array
for current Device location, update\nfor (var i in currentLoc) {\n if (currentLoc[i].name
== msg.payload[0].name) {\n currentLoc[i].lat = msg.payload[0].lat;\n
currentLoc[i].lon = msg.payload[0].lon;\n currentLoc[i].icon = msg.payload[0].icon;\n
currentLoc[i].iconColor = msg.payload[0].iconColor;\n currentLoc[i].time =
msg.payload[0].time;\n global.set('pos',currentLoc);\n return msg;\n
}\n}\n//If no existed device saved\ncurrentLoc.push(msg.payload[0])\nglobal.set('pos',currentLoc);\nreturn
msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1140,"y":80,"wires":[[]]},{"id":"bb80be63.25387","type":"function","z":"b18b632d.3d3d7","name":"Get
Latest Location","func":"//global.set('pos',[])\nmsg.payload = global.get('pos');\nreturn
msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1320,"y":440,"wires":[["b821bdc5.79e3b8","6a8bacf8.cc9b5c"]]},{"id":"1171c34e.bf7a5d","type":"ui_worldmap","z":"b18b632d.3d3d7","group":"e1937c58.f4abc","order":1,"width":0,"height":0,"name":"","lat":"16.072","lon":"108.250","zoom":"14","layer":"OSM","cluster":"","maxage":"","usermenu":"hide","layers":"hide","panit":"false","panlock":"false","zoomlock":"false","hiderightclick":"true","coords":"none","showgrid":"false","path":"/worldmap","x":1660,"y":120,"wires":[]},{"id":"6a8bacf8.cc9b5c","type":"delay","z":"b18b632d.3d3d7","name":"","pauseType":"delay","timeout":"7","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1260,"y":380,"wires":[["1171c34e.bf7a5d","a629b170.04075"]]},{"id":"a629b170.04075","type":"worldmap-tracks","z":"b18b632d.3d3d7","name":"","depth":20,"layer":"combined","x":1510,"y":60,"wires":[["1171c34e.bf7a5d"]]},{"id":"a97d3011.97edc","type":"mqtt
out","z":"b18b632d.3d3d7","name":"","topic":"phone/location","qos":"","retain":"","broker":"b5997a7e.f2121","x":1070,"y":340,"wires":[]},{"id":"14855d88.49e1ba","type":"mqtt
in","z":"b18b632d.3d3d7","name":"","topic":"phone/location","qos":"2","datatype":"auto","broker":"b5997a7e.f2121","x":1080,"y":180,"wires":[["39b220f6.aa27c8"]]},{"id":"e1937c58.f4abc","type":"ui_group","z":"","name":"Camera
Street","tab":"b1c6e79c.31e678","order":1,"disp":false,"width":"8","collapse":false},{"id":"b5997a7e.f2121","type":"mqtt-broker","z":"","name":"MQTT
Server","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"b1c6e79c.31e678","type":"ui_tab","z":"","name":"Tầng
1","icon":"dashboard","order":1,"disabled":false,"hidden":false}]