Enhanced Second Flow Example (earthquakes)

Enhanced version of second flow https://nodered.org/docs/tutorials/second-flow.

Added:

  • Dashboard
  • Show earthquakes in wordlmap
  • Button to filter mag of showed earthquakes
  • Button to show a table with selected earthquakes
[{"id":"296b474708347525","type":"tab","label":"Terremotos","disabled":false,"info":"# Flujo terremotos\nFlujo","env":[]},{"id":"32c4a6f107f72a16","type":"group","z":"296b474708347525","name":"Mapas","style":{"fill":"#bfdbef","label":true},"nodes":["0179ef5badd1f526","4935316d5de6c7d9","59381ce509471418"],"x":814,"y":19,"w":212,"h":202},{"id":"c440b71cc6eefe20","type":"group","z":"296b474708347525","name":"Filtro","style":{"fill":"#ffbfbf","label":true},"nodes":["f099d77ea2318bec","975553223d6e8529"],"x":14,"y":339,"w":372,"h":82},{"id":"b88b528964a3ea35","type":"group","z":"296b474708347525","name":"Extrae, filtra y guarda datos","style":{"fill":"#ffefbf","label":true},"nodes":["c17f139df19c9b81","ab253e854db40349","4952bd8b66b6017f","d7c2bd782a95a3b0","800fa97a0c4ef048","29087b40ce1d1cfc","d4abb3fc263e2c7c","a41bb21b4324aaf5","324cdce71ab7df7e","eeb380c1b6c08e85","11e3cb1865d7d1d4","b8d18ae172606341","4d994291bf6993a6","f8aafa535a7da2bf"],"x":14,"y":19,"w":772,"h":302},{"id":"c17f139df19c9b81","type":"inject","z":"296b474708347525","g":"b88b528964a3ea35","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"3600","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":60,"wires":[["ab253e854db40349"]]},{"id":"ab253e854db40349","type":"http request","z":"296b474708347525","g":"b88b528964a3ea35","name":"API Terremotos","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/significant_month.csv","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":340,"y":60,"wires":[["d7c2bd782a95a3b0"]],"inputLabels":["url"],"outputLabels":["csv"],"info":"Llamada API Terremotos"},{"id":"4952bd8b66b6017f","type":"csv","z":"296b474708347525","g":"b88b528964a3ea35","name":"","sep":",","hdrin":"","hdrout":"all","multi":"one","ret":"\\n","temp":"","skip":"0","strings":false,"include_empty_strings":"","include_null_values":"","x":450,"y":120,"wires":[["29087b40ce1d1cfc"]]},{"id":"d7c2bd782a95a3b0","type":"csv","z":"296b474708347525","g":"b88b528964a3ea35","name":"","sep":",","hdrin":true,"hdrout":"none","multi":"one","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":510,"y":60,"wires":[["800fa97a0c4ef048"]]},{"id":"800fa97a0c4ef048","type":"switch","z":"296b474708347525","g":"b88b528964a3ea35","name":"","property":"payload.mag","propertyType":"msg","rules":[{"t":"gt","v":"mag","vt":"flow"}],"checkall":"true","repair":false,"outputs":1,"x":630,"y":60,"wires":[["d4abb3fc263e2c7c","4935316d5de6c7d9"]]},{"id":"29087b40ce1d1cfc","type":"file","z":"296b474708347525","g":"b88b528964a3ea35","name":"","filename":"/home/pi/terremotos.csv","appendNewline":true,"createDir":false,"overwriteFile":"true","encoding":"none","x":630,"y":120,"wires":[[]]},{"id":"d4abb3fc263e2c7c","type":"join","z":"296b474708347525","g":"b88b528964a3ea35","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"5","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":330,"y":120,"wires":[["4952bd8b66b6017f"]]},{"id":"324cdce71ab7df7e","type":"ui_button","z":"296b474708347525","g":"b88b528964a3ea35","name":"","group":"69b7d38b379296e4","order":2,"width":4,"height":1,"passthru":false,"label":"Muestra Tabla","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":120,"y":220,"wires":[["eeb380c1b6c08e85"]]},{"id":"eeb380c1b6c08e85","type":"file in","z":"296b474708347525","g":"b88b528964a3ea35","name":"","filename":"/home/pi/terremotos.csv","format":"utf8","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":370,"y":220,"wires":[["b8d18ae172606341"]]},{"id":"0179ef5badd1f526","type":"worldmap","z":"296b474708347525","g":"32c4a6f107f72a16","name":"","lat":"42.47","lon":"-2.44","zoom":"2","layer":"OSMG","cluster":"","maxage":"","usermenu":"show","layers":"show","panit":"false","panlock":"false","zoomlock":"false","hiderightclick":"false","coords":"none","showgrid":"false","allowFileDrop":"false","path":"/worldmap","overlist":"DR,CO,RA,DN,HM","maplist":"OSMG,OSMC,EsriC,EsriS,EsriT,EsriDG,UKOS","mapname":"","mapurl":"","mapopt":"","mapwms":false,"x":900,"y":120,"wires":[]},{"id":"4935316d5de6c7d9","type":"change","z":"296b474708347525","g":"32c4a6f107f72a16","name":"","rules":[{"t":"move","p":"payload.latitude","pt":"msg","to":"payload.lat","tot":"msg"},{"t":"set","p":"payload.lon","pt":"msg","to":"payload.longitude","tot":"msg"},{"t":"move","p":"payload.place","pt":"msg","to":"payload.name","tot":"msg"},{"t":"set","p":"payload.layer","pt":"msg","to":"puntos","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":920,"y":60,"wires":[["59381ce509471418","0179ef5badd1f526"]]},{"id":"59381ce509471418","type":"ui_worldmap","z":"296b474708347525","g":"32c4a6f107f72a16","group":"3c6a2ff2f74cc0ef","order":2,"width":16,"height":9,"name":"","lat":"42.47","lon":"-2.44","zoom":"2","layer":"OSMG","cluster":"","maxage":"","usermenu":"hide","layers":"hide","panit":"false","panlock":"false","zoomlock":"false","hiderightclick":"true","coords":"none","showgrid":"false","allowFileDrop":"false","path":"/worldmap","overlist":"DR,CO,RA,DN,HM","maplist":"OSMG,OSMC,EsriC,EsriS,EsriT,EsriDG,UKOS","mapname":"","mapurl":"","mapopt":"","mapwms":false,"x":900,"y":180,"wires":[]},{"id":"a41bb21b4324aaf5","type":"ui_button","z":"296b474708347525","g":"b88b528964a3ea35","name":"","group":"69b7d38b379296e4","order":1,"width":4,"height":1,"passthru":false,"label":"Actualiza Mapa","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":120,"y":100,"wires":[["ab253e854db40349","f8aafa535a7da2bf"]]},{"id":"b8d18ae172606341","type":"csv","z":"296b474708347525","g":"b88b528964a3ea35","name":"","sep":",","hdrin":true,"hdrout":"none","multi":"mult","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":570,"y":220,"wires":[["11e3cb1865d7d1d4"]]},{"id":"4d994291bf6993a6","type":"inject","z":"296b474708347525","g":"b88b528964a3ea35","name":"Inicializa tabla","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"[]","payloadType":"json","x":520,"y":280,"wires":[["11e3cb1865d7d1d4"]]},{"id":"f099d77ea2318bec","type":"ui_text_input","z":"296b474708347525","g":"c440b71cc6eefe20","name":"","label":"Filtro magnitud","tooltip":"","group":"69b7d38b379296e4","order":2,"width":0,"height":0,"passthru":true,"mode":"number","delay":300,"topic":"topic","sendOnBlur":true,"className":"","topicType":"msg","x":120,"y":380,"wires":[["975553223d6e8529"]]},{"id":"975553223d6e8529","type":"change","z":"296b474708347525","g":"c440b71cc6eefe20","name":"","rules":[{"t":"set","p":"mag","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":380,"wires":[[]]},{"id":"11e3cb1865d7d1d4","type":"ui_table","z":"296b474708347525","g":"b88b528964a3ea35","group":"3c6a2ff2f74cc0ef","name":"","order":1,"width":16,"height":3,"columns":[{"field":"time","title":"time","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"latitude","title":"latitude","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"longitude","title":"longitude","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"mag","title":"mag","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"place","title":"place","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}}],"outputs":0,"cts":false,"x":710,"y":220,"wires":[]},{"id":"f8aafa535a7da2bf","type":"change","z":"296b474708347525","g":"b88b528964a3ea35","name":"Limpia capa","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"command\":{\"clear\":\"puntos\"}}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":160,"wires":[["0179ef5badd1f526","59381ce509471418"]]},{"id":"69b7d38b379296e4","type":"ui_group","name":"Actualiza","tab":"78fb913c6b3740de","order":1,"disp":true,"width":4,"collapse":false,"className":""},{"id":"3c6a2ff2f74cc0ef","type":"ui_group","name":"Resultado","tab":"78fb913c6b3740de","order":2,"disp":true,"width":16,"collapse":false,"className":""},{"id":"78fb913c6b3740de","type":"ui_tab","name":"Terremotos","icon":"dashboard","order":2,"disabled":false,"hidden":false}]

Flow Info

Created 2 years, 2 months ago
Updated 2 years ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x3)
  • csv (x3)
  • file (x1)
  • file in (x1)
  • http request (x1)
  • inject (x2)
  • join (x1)
  • switch (x1)
Other

Tags

  • earthquakes
  • table
  • worldmap
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option