Shiny Earthquakes

a interactive map of earthquakes in Shiny

Giacomo Debidda

Do you know how many earthquakes occur each year?

  1. 10
  2. 100
  3. 1000
  4. 1,000,000+

Remember: ALL earthquakes, not just the big ones!

The USGS estimates that several million earthquakes occur in the world each year. Many go undetected because they hit remote areas or have very small magnitudes. The NEIC now locates about 50 earthquakes each day, or about 20,000 a year. (Credit: U.S. Geological Survey, Department of the Interior/USGS)

Where and When?

As you can hear from Michael Blanpied (U.S. Geological Survey) in this podcast:

"There is currently no organization government or scientist capable of succesfully predicting the time and occurrence of an earthquake."

Michael Blanpied

But we can still see where, when, and how many earthquakes occurred.
First of all, we need some good and recent data...

See also: USGS CoreCast.

Credit: U.S. Geological Survey
Department of the Interior/USGS
U.S. Geological Survey/audio file by Jessica Robertson

Get the Data

# Required packages
library(shiny)
library(RJSONIO)
suppressPackageStartupMessages(library(googleVis))
# Download USGS GeoJSON feed: data from Magnitude 4.5+ earthquakes occurred
# in the past 30 days (data on the USGS website is updated every 15 minutes)
url <- "http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/4.5_month.geojson"
# download GeoJSON file (~1.7 MB, code not evaluated here)
document <- fromJSON(content=url)
# Parse GeoJSON
metadata <- document$metadata
eq.properties <- lapply(document$features,function(xl) xl$properties) 
eq.geometry <- lapply(document$features,function(xl) xl$geometry)

Here is ShinyEarthquakes!