This flow gathers the location of earthquakes and displays them on Google Maps.
This flow displays the location of earthquakes on Google Maps. The flow uses the GET method to obtain earthquake data from the U.S. Geological Survey site. The data is received in CSV format and parsed to json. It is then sent by the websocket and the location is displayed on Google Maps.
- http in
- http out
- http request
- websocket in
- websocket out
- each and next
Note: The websocket address appears under the ‘Endpionts’ tab after you deploy the project.
- websocket in node – Opens the websocket listener socket.
- http request node – Send a GET request to retrieve earthquake data.
- function node - Splits the msg.payload to an array.
- each & next nodes - Loops over the msg.payload array.
- csv node - Parses the CSV data to json.
- websocket out node - Publishes the earthquake locations to the websocket clients.
- http in node - Listens to the defined URL and awakens when a GET method is detected.
- template node - Creates a webpage based on the Google Map API and connects to the websocket.
- http out node - Sends 200 OK response.
- delay node - Initiates a one second delay between creation of the webpage and the data GET request.
This flow uses the following links:
Google map API:
U.S. Geological Survey: