Space Station Example

This flow uses the template node to embed a Map. It then embeds the tracks of the exact location of the International Space Station onto the map.

About this Flow :

This flow uses the template dashboard node to embed a world map. Then it uses the world map nodes to plot tracks of the ISS location. To see this flow in action install node-red-contrib-web-worldmap nodes in manage pallet.

Import this flow from here :

[{"id":"2e17c6be.73371a","type":"tab","label":"Space Station","disabled":false,"info":""},{"id":"ef4cb1a.87258d","type":"inject","z":"2e17c6be.73371a","name":"Every 5 sec","topic":"","payload":"","payloadType":"date","repeat":"5","crontab":"","once":false,"onceDelay":"","x":130,"y":180,"wires":[["5740ee56.e02b9"]]},{"id":"431abcaa.a86a4c","type":"http request","z":"2e17c6be.73371a","name":"","method":"GET","ret":"obj","paytoqs":false,"url":"http://api.open-notify.org/iss-now.json","tls":"","proxy":"","x":610,"y":180,"wires":[["a0b54275.fdffa","88797856.1dede8"]]},{"id":"a0b54275.fdffa","type":"debug","z":"2e17c6be.73371a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":790,"y":240,"wires":[]},{"id":"88797856.1dede8","type":"function","z":"2e17c6be.73371a","name":"Extract ISS Location","func":"var iss_location = msg.payload.iss_position;\n\nmsg.payload = { \n        name : \"International Space Station\",\n        lat  : parseFloat(iss_location.latitude),\n        lon  : parseFloat(iss_location.longitude),\n//        icon:\"uav\",\n        icon: \"fa-space-shuttle\",\n        iconColor:'#900000',\n        command : { \"zoom\" : 5 }\n};\n\nreturn msg;","outputs":1,"noerr":0,"x":820,"y":180,"wires":[["2c4edb22.0e8b7c","ce09ee81.f288b","d9bb1570.f3c058"]]},{"id":"2c4edb22.0e8b7c","type":"debug","z":"2e17c6be.73371a","name":"","active":true,"console":"false","complete":"false","x":1030,"y":240,"wires":[]},{"id":"347e393a.d67736","type":"ui_template","z":"2e17c6be.73371a","group":"d20c8bbb.c142b8","name":"Embedded Map","order":0,"width":"20","height":"15","format":"<div ng-bind-html=\"msg.payload | trusted\"></div>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":780,"y":100,"wires":[[]]},{"id":"a728c35a.c1429","type":"template","z":"2e17c6be.73371a","name":"Add Map to Dashboard","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<iframe src={{{payload.url}}} height=750px width=1000px ></iframe>","x":550,"y":100,"wires":[["347e393a.d67736"]]},{"id":"d720d4e.7019e28","type":"comment","z":"2e17c6be.73371a","name":"One time - Add Map to Dashboard","info":"","x":180,"y":60,"wires":[]},{"id":"9479465b.ea08c8","type":"inject","z":"2e17c6be.73371a","name":"Init WorldMap","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":true,"onceDelay":"","x":130,"y":100,"wires":[["ad2c3d03.9a2be"]]},{"id":"ad2c3d03.9a2be","type":"function","z":"2e17c6be.73371a","name":"Inject /worldmap","func":"msg.payload =   {\n                url : \"/worldmap\",\n                command : {\n                        layer:\"Esri Satellite\",\n                        lat:40.978679,\n                        lon:-74.1015797,\n                        zoom:5,\n                        map: { name: \"Esri Satellite\" },\n                        addtoheatmap:true, \n                        autopan:true\n                        }\n                };\nreturn msg;","outputs":1,"noerr":0,"x":320,"y":100,"wires":[["a728c35a.c1429"]]},{"id":"854255a9.3272a8","type":"comment","z":"2e17c6be.73371a","name":"Query the location of the International Space Station","info":"","x":234.44444444444446,"y":144.44444444444443,"wires":[]},{"id":"5740ee56.e02b9","type":"ui_switch","z":"2e17c6be.73371a","name":"","label":"switch","tooltip":"","group":"8ba82d7d.d6815","order":0,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":290,"y":180,"wires":[["5e151b68.97cb6c"]]},{"id":"5e151b68.97cb6c","type":"switch","z":"2e17c6be.73371a","name":"Switch On","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":440,"y":180,"wires":[["431abcaa.a86a4c"]]},{"id":"ce09ee81.f288b","type":"worldmap","z":"2e17c6be.73371a","name":"","lat":"","lon":"","zoom":"5","layer":"Esri Satellite","cluster":"","maxage":"","usermenu":"show","panit":"true","hiderightclick":"false","coords":"none","path":"","x":1070,"y":180,"wires":[]},{"id":"d9bb1570.f3c058","type":"worldmap-tracks","z":"2e17c6be.73371a","name":"","depth":"20","x":950,"y":120,"wires":[["ce09ee81.f288b"]]},{"id":"d20c8bbb.c142b8","type":"ui_group","z":"2e17c6be.73371a","name":"Space Station","tab":"d79763ec.17455","order":2,"disp":true,"width":"20"},{"id":"8ba82d7d.d6815","type":"ui_group","z":"","name":"Start/Stop","tab":"d79763ec.17455","order":1,"disp":true,"width":"3"},{"id":"d79763ec.17455","type":"ui_tab","z":"2e17c6be.73371a","name":"International Space Station Location","icon":"fa-space-shuttle","order":10}]

Last updated