-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathearthquakes.json
1 lines (1 loc) · 11.8 KB
/
earthquakes.json
1
[{"id":"111d7605.f6cdc2","type":"tab","label":"Earthquakes","disabled":false,"info":""},{"id":"743f2943.c92ec","type":"ui_group","z":"","name":"Quake EpiCenters","tab":"e4847ede.ebc6","order":2,"disp":true,"width":"21","collapse":false},{"id":"bf987639.9e4808","type":"ui_group","z":"","name":"Start/Stop","tab":"e4847ede.ebc6","order":1,"disp":true,"width":"3","collapse":false},{"id":"579371a5.c09ff8","type":"ui_group","z":"","name":"Earthquakes over the past 2.5 Days","tab":"e4847ede.ebc6","order":3,"disp":true,"width":"11","collapse":false},{"id":"e4847ede.ebc6","type":"ui_tab","z":"","name":"Earthquakes","icon":"dashboard","order":7,"disabled":false,"hidden":false},{"id":"91e741c3.90f6f8","type":"ui_base","theme":{"name":"theme-light","lightTheme":{"default":"#0094CE","baseColor":"#0094CE","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#097479","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":false},"customTheme":{"name":"Untitled Theme 1","default":"#4B7930","baseColor":"#4B7930","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"},"themeState":{"base-color":{"default":"#0094CE","value":"#0094CE","edited":false},"page-titlebar-backgroundColor":{"value":"#0094CE","edited":false},"page-backgroundColor":{"value":"#fafafa","edited":false},"page-sidebar-backgroundColor":{"value":"#ffffff","edited":false},"group-textColor":{"value":"#1bbfff","edited":false},"group-borderColor":{"value":"#ffffff","edited":false},"group-backgroundColor":{"value":"#ffffff","edited":false},"widget-textColor":{"value":"#111111","edited":false},"widget-backgroundColor":{"value":"#0094ce","edited":false},"widget-borderColor":{"value":"#ffffff","edited":false},"base-font":{"value":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"}},"angularTheme":{"primary":"indigo","accents":"blue","warn":"red","background":"grey"}},"site":{"name":"Node-RED Dashboard","hideToolbar":"false","allowSwipe":"false","lockMenu":"false","allowTempTheme":"true","dateFormat":"DD/MM/YYYY","sizes":{"sx":48,"sy":48,"gx":6,"gy":6,"cx":6,"cy":6,"px":0,"py":0}}},{"id":"c3023562.6b119","type":"function","z":"111d7605.f6cdc2","name":"remap property names","func":"msg.payload.lat = msg.payload.latitude;\nmsg.payload.lon = msg.payload.longitude;\nmsg.payload.layer = msg.payload.type;\nmsg.payload.icon = msg.payload.type;\nmsg.payload.name = msg.payload.id;\n\ndelete msg.payload.latitude;\ndelete msg.payload.longitude;\ndelete msg.payload.type;\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":120,"wires":[["215a3721.5203a8"]]},{"id":"215a3721.5203a8","type":"debug","z":"111d7605.f6cdc2","name":"","active":true,"tosidebar":true,"console":false,"complete":"payload","x":840,"y":120,"wires":[]},{"id":"72f787f7.7dfac","type":"csv","z":"111d7605.f6cdc2","name":"","sep":",","hdrin":true,"hdrout":"","multi":"one","ret":"\\n","temp":"","x":450,"y":119,"wires":[["c3023562.6b119"]]},{"id":"df1f1ab3.a49d9","type":"http request","z":"111d7605.f6cdc2","name":"","method":"GET","url":"http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_day.csv","tls":"","x":290,"y":119,"wires":[["72f787f7.7dfac"]]},{"id":"7413ff38.ec0af","type":"inject","z":"111d7605.f6cdc2","name":"quakes","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"x":120,"y":119,"wires":[["df1f1ab3.a49d9"]]},{"id":"ecb1c0c9.6bc3f","type":"comment","z":"111d7605.f6cdc2","name":"Earthquakes - Simple","info":"Press the button on the `inject` node to get the list of earthquakes from the USGS public API.\n\nThis returns a CSV - which we then parse using the `CSV` node into individual objects.\n\nThese are then passed through a `function` to remap the property names into ones \nsuitable for the map node, and passed to the `web-socket` out node.\n\nThe map will be served at http://localhost:1880/worldmap .\nYou will need to zoom out :-)","x":160,"y":80,"wires":[]},{"id":"aac53e3c.8773f","type":"function","z":"111d7605.f6cdc2","name":"USGS Quake monitor csv re-parse","func":"msg.payload.lat = msg.payload.latitude;\nmsg.payload.lon = msg.payload.longitude;\nmsg.payload.name = msg.payload.id;\nmsg.payload.icon = \"globe\";\nif( msg.payload.mag > 4 ) {\n msg.payload.iconColor = \"red\";\n} else {\n msg.payload.iconColor = \"orange\";\n}\n\nif( msg.payload.mag > 5 ) {\n msg.alert = true;\n} \n\ndelete msg.payload.latitude;\ndelete msg.payload.longitude;\ndelete msg.payload.type;\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":460,"wires":[["ba112a46.d8c29","f505f82a.dc3cf8","20a32032.e76cd"]]},{"id":"c695ac66.0ac9b","type":"csv","z":"111d7605.f6cdc2","name":"","sep":",","hdrin":true,"hdrout":"","multi":"one","ret":"\\n","temp":"","skip":"0","x":350,"y":460,"wires":[["aac53e3c.8773f","fe616b0f.d735a"]]},{"id":"651ee3ba.245694","type":"http request","z":"111d7605.f6cdc2","name":"","method":"GET","url":"http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_day.csv","x":170,"y":460,"wires":[["c695ac66.0ac9b","40ebe302.e7c4dc"]]},{"id":"a0cb1987.50cda8","type":"inject","z":"111d7605.f6cdc2","name":"Quakes","topic":"","payload":"","payloadType":"str","repeat":"900","crontab":"","once":false,"x":140,"y":220,"wires":[["b2fa688f.94ce78"]]},{"id":"ba112a46.d8c29","type":"debug","z":"111d7605.f6cdc2","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":950,"y":460,"wires":[]},{"id":"c121c997.8bd44","type":"switch","z":"111d7605.f6cdc2","name":"Switch On","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","outputs":1,"x":470,"y":220,"wires":[["651ee3ba.245694","20a32032.e76cd"]]},{"id":"b2fa688f.94ce78","type":"ui_switch","z":"111d7605.f6cdc2","name":"","label":"Start/Stop","group":"bf987639.9e4808","order":1,"width":"3","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":300,"y":220,"wires":[["c121c997.8bd44"]]},{"id":"40ebe302.e7c4dc","type":"function","z":"111d7605.f6cdc2","name":"Parse Quake Data","func":"// splits giant string of Earthquake csv data at each new line\nquakes = msg.payload.split(/\\r\\n|\\r|\\n/);\n// Skip the first line - which contains column headers\n// The array of json objects could be\n// Quake = { \"time\",\n// \"latitude\",\n// \"longitude\",\n// \"depth\",\n// \"mag\",\n// \"magType\",\n// \"nst\",\n// \"gap\",\n// \"dmin\",\n// \"rms\",\n// \"net\",\n// \"id\",\n// \"updated\",\n// \"place\",\n// \"type\",\n// \"horizontalError\",\n// \"depthError\",\n// \"magError\",\n// \"magNst\",\n// \"status\",\n// \"locationSource\",\n// \"magSource\"\n// };\n// eg:\n// \"2018-09-16T22:04:11.440Z,36.8370018,-121.5719986,5.99,2.56,md,50,36,0.03809,0.11,nc,nc73085075,2018-09-16T22:25:02.684Z,\"3km WSW of San Juan Bautista, CA\",earthquake,0.19,0.4,0.17,32,automatic,nc,nc\"\n// [\"2018-09-16T22:04:11.440Z\",\"36.8370018\",\"-121.5719986\",\"5.99\",\"2.56\",\"md\",\"50\",\"36\",\"0.03809\",\"0.11\",\"nc\",\"nc73085075\",\"2018-09-16T22:25:02.684Z\",\"\\\"3km WSW of San Juan Bautista\",\" CA\\\"\",\"earthquake\",\"0.19\",\"0.4\",\"0.17\",\"32\",\"automatic\",\"nc\",\"nc\"]\n\nvar QuakeArray = [];\nvar ThisQuake = {};\n// Start at 1 because 0 has the column headers\nfor( var i = 1; i < quakes.length; i++ ) {\n // Split each line into a json object that describes an earthquake\n columns = quakes[i].split(',');\n\n // We only care about \"place\" and \"mag\" for our little table\n // place is column[13]\n // mag is column[4]\n // Build a json object\n\n // The Location string will often contain quoted \"South of Tonga\"\n // It looks strange in the dashboard table so remove the \"\" \n if( typeof( columns[13] ) != 'undefined') {\n columns[13] = columns[13].replace(/\"/g, '');\n // Build a json object\n ThisQuake = {\"Location\":columns[13],\"Mag\":columns[4],\"lat\":columns[1],\"lng\":columns[2],\"time\":columns[0]};\n // Add this Quake to an array of Quakes from the 2.5 Day CSV\n QuakeArray.push( ThisQuake );\n }\n}\nmsg.payload = QuakeArray;\nreturn msg;\n","outputs":1,"noerr":0,"x":370,"y":380,"wires":[["59c60e9b.e9cb98","8cb7b45f.6f49b8"]]},{"id":"59c60e9b.e9cb98","type":"debug","z":"111d7605.f6cdc2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":570,"y":340,"wires":[]},{"id":"fe616b0f.d735a","type":"debug","z":"111d7605.f6cdc2","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":510,"y":500,"wires":[]},{"id":"f505f82a.dc3cf8","type":"switch","z":"111d7605.f6cdc2","name":"Big Quake Alert","property":"alert","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":740,"y":520,"wires":[["770f2cf.483f4d4"]]},{"id":"770f2cf.483f4d4","type":"template","z":"111d7605.f6cdc2","name":"Big Quake Alert","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload.mag}} magnitude quake {{payload.place}} !","output":"str","x":960,"y":520,"wires":[["ba51eb06.c6f75","6e1afc24.0b493c"]]},{"id":"ba51eb06.c6f75","type":"debug","z":"111d7605.f6cdc2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1170,"y":500,"wires":[]},{"id":"6e1afc24.0b493c","type":"ui_toast","z":"111d7605.f6cdc2","position":"top right","displayTime":"5","highlight":"","outputs":0,"ok":"OK","cancel":"","topic":"","name":"","x":1180,"y":540,"wires":[]},{"id":"bb04245c.d7cbf","type":"debug","z":"111d7605.f6cdc2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":950,"y":380,"wires":[]},{"id":"d4b98a56.00556","type":"function","z":"111d7605.f6cdc2","name":"Zoom","func":"msg.payload = { command : { zoom:8, \n \"lat\":msg.payload.lat,\n \"lon\":msg.payload.lng,\n autopan:true }\n};\nreturn msg;","outputs":1,"noerr":0,"x":730,"y":380,"wires":[["bb04245c.d7cbf","20a32032.e76cd"]]},{"id":"20a32032.e76cd","type":"ui_worldmap","z":"111d7605.f6cdc2","group":"743f2943.c92ec","order":1,"width":"21","height":"14","name":"","lat":"","lon":"","zoom":"2","layer":"Esri Ocean","cluster":"","maxage":"","usermenu":"hide","layers":"hide","panit":"false","panlock":"false","zoomlock":"false","hiderightclick":"true","coords":"none","showgrid":"false","path":"/quakes","x":940,"y":220,"wires":[]},{"id":"8cb7b45f.6f49b8","type":"ui_table","z":"111d7605.f6cdc2","group":"579371a5.c09ff8","name":"","order":1,"width":"11","height":"14","columns":[{"field":"Location","title":"Location","width":"40%","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"Mag","title":"Mag","width":"10%","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"lat","title":"Lat","width":"15%","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"lng","title":"Lng","width":"15%","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"time","title":"Time","width":"20%","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}}],"outputs":1,"cts":true,"x":570,"y":380,"wires":[["d4b98a56.00556"]]},{"id":"82ec3459.35dec","type":"comment","z":"111d7605.f6cdc2","name":"Earthquakes - map and table","info":"","x":180,"y":180,"wires":[]}]