2020-12-14 20:28:21 +01:00
|
|
|
#!/snap/bin/powershell
|
|
|
|
|
2020-12-14 20:41:06 +01:00
|
|
|
# Syntax: ./list-earthquakes.ps1
|
|
|
|
# Description: lists earthquakes >= 6.0 for the last 30 days
|
2020-12-14 20:28:21 +01:00
|
|
|
# Author: Markus Fleschutz
|
|
|
|
# Source: github.com/fleschutz/PowerShell
|
|
|
|
# License: CC0
|
|
|
|
|
|
|
|
$Format="csv" # csv, geojson, kml, text, xml
|
|
|
|
$MinMagnitude=6.0
|
2020-12-14 20:36:44 +01:00
|
|
|
$OrderBy="time" # time, time-asc, magnitude, magnitude-asc
|
2020-12-14 20:28:21 +01:00
|
|
|
|
|
|
|
try {
|
|
|
|
Write-Progress "Querying earthquakes for the last 30 days ..."
|
2020-12-14 20:36:44 +01:00
|
|
|
(Invoke-WebRequest -Uri "https://earthquake.usgs.gov/fdsnws/event/1/query?format=$Format&minmagnitude=$MinMagnitude&orderby=$OrderBy" -UserAgent "curl" ).Content
|
2020-12-14 20:28:21 +01:00
|
|
|
exit 0
|
|
|
|
} catch {
|
|
|
|
Write-Error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
|
|
|
exit 1
|
|
|
|
}
|