Automatically detect new data and download USGS ShakeMap GIS files for earthquakes.
Created: 4/26/2017
Last update: 9/3/2024
This script will download all new (or reviewed/updated) ShakeMap files from a chosen USGS FeedURL. It can be set to run on a local computer's Task Scheduler to check for new events at a set repeat interval, or modified to run in the cloud and export files to a data warehouse.
ShakeMap API returns GeoJSON for each detected earthquake event. The data within the GeoJSON is extracted to the user's specified folder. In addition, a csv is generated using the epicenter lat/lon (WKT), and includes other attributes available within the GeoJSON. Only earthquakes within the outer bounds of the Continental US, Alaska, Hawaii and Puerto Rico will be downloaded.
For each earthquake event detected in the FeedURL that is located within the USA (CONUS, AK, HI, PR), the following files are generated/extracted:
Generated files:
epicenter.geoparquet
- contains the following information about the earthquake:- event_id
- title
- magnitude
- date_time
- place
- depth_km
- url
- status
- updated
- geometry (lat/lon of epicenter)
event_info.txt
- log file containing information about the event status (whether or not the files have been reviewed, udpated, etc) and timestamps
USGS ShakeMap GIS files:
mi.geoparquet
- macroseismic intensitypga.geoparquet
- peak ground accelerationpgv.geoparquet
- peak ground velocitypsa0p3.geoparquet
- 0.3 second peak spectral accelerationpsa1p0.geoparquet
- 1.0 second peak spectral accelerationpsa3p0.geoparquet
- 3.0 second peak spectral acceleration
Code has been modified from this original source.
Requirements: Python 3.7+
Environment Setup: From the repository, run the following command to install the required Python libraries:
pip install -r requirements.txt
If you further modify the Python environment, commit back to the requrements.txt file using:
pip list --format=freeze > requirements.txt
New USGS ShakeMap files will be saved in the folder called: ShakeMaps/
Steps:
-
Specify the FEEDURL in
constants.py
. ONLY ONE of the feedurls should be un-commented, depending on the filter you want to apply to the API. Read more information about FEEDURLs here. -
Run the EarthquakeEventPinger:
python pinger/ping.py