The USGS is responsible for providing scientific data about natural hazards, the health of our ecosystems and environment; and the impacts of climate and land-use change. Their scientists develop new methods and tools to supply timely, relevant, and useful information about the Earth and its processes. This project uses Leaflet to map earthquakes all over the world.
- D3
- Leaflet
- Javascript
- HTML
- CSS
-
Getting the data set
The USGS provides earthquake data in a number of different formats, updated every 5 minutes. The USGS GeoJSON Feed page provides different data to choose from. Each data set gives a JSON representation of that data. The data set used here was for all earthquakes within the past 7 days.
-
Import & Visualize the Data
Created a map using Leaflet that plots all of the earthquakes from the data set based on their longitude and latitude.
-
Data markers reflect the magnitude of the earthquake in their size and color. Earthquakes with higher magnitudes appear larger and darker in color.
-
Popups provide additional information about the earthquake when a marker is clicked.
-
A legend for the earthquake magnitude.
-
-
Added a number of base maps to choose from.
-
Added layer controls to the map.
- Create a Mapbox access token: https://docs.mapbox.com/help/how-mapbox-works/access-tokens/
- Copy the
config_example.js
and rename itconfig.js
- Insert your token into
config.js
- Open a terminal in the downloaded repo and run the command
python -m http.server
- Paste url link into browser: http://localhost:8000/