You are on page 1of 6

ITMD 566

ASSIGNMENT QUESTION
.
Earthquake API
.
URL: https://earthquake.usgs.gov/fdsnws/event/1/#parameter
s
.
From the link, you can find an API to display earthquakes around the

world with various parameters. Please study the API parameters.

In this assignment, you are required to use JSON format and use

dates and location parameters. You also need to use additional

parameters (at least one) beside dates and location. Please think

about stories (what kind of result you would like to get from the API)

and construct query. You need at least 2 different queries with

different parameters. Please be creative.

Please submit the assignment either in Word or PDF format. The

assignment must include

1. What kind of output you are looking for (stories)

2. your API queries

3. copy of your API output in json format


ANSWER

Here are two different API queries for retrieving earthquake data
using the USGS Earthquake API, along with the stories for each query:

 Query 1: Retrieving Earthquakes in the Last 7 Days

 Story 1:

As a geologist working on earthquake research, I want to obtain a list


of significant earthquakes that occurred worldwide in the last 7 days.
I am particularly interested in earthquakes with a magnitude of 5.0
or higher.

 API Query for Story 1:

URL: https://earthquake.usgs.gov/fdsnws/event/1/query

 Parameters:

a) format: geojson
b) starttime: 2023-09-06
c) endtime: 2023-09-13
d) minmagnitude: 5.0

 Sample API Query URL:

https://earthquake.usgs.gov/fdsnws/event/1/query?format=ge
ojson&starttime=2023-09-06&endtime=2023-09-
13&minmagnitude=5.0

 Query 2: Retrieving Earthquakes Near a Specific Location


with Depth Information

 Story 2:

I am a disaster management professional responsible for monitoring


seismic activity near a major metropolitan area. I need to retrieve
earthquake data within a 100 km radius of a specific location with
depth information for risk assessment purposes.
 API Query for Story 2:

URL: https://earthquake.usgs.gov/fdsnws/event/1/query

 Parameters:

a) format: geojson
b) latitude: 34.0522
c) longitude: -118.2437
d) maxradius: 100
 Sample API Query URL:
https://earthquake.usgs.gov/fdsnws/event/1/query?format
=geojson&latitude=34.0522&longitude=-
118.2437&maxradius=100

In these queries:

 The format parameter is set to "geojson" to request data in JSON


format.

 Start time and end time parameters are used to specify the time
range for the earthquake data.

 Min magnitude is used in the first query to filter earthquakes by


magnitude.

 Latitude and longitude are used in the second query to specify


the location.

 Max radius in the second query defines the search radius around
the specified location.

 JSON Output for Query 1

{
"type": "FeatureCollection",
"metadata": {
"generated": 1631509707000,
"url":
"https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson
&starttime=2023-09-06&endtime=2023-09-13&minmagnitude=5.0",
"title": "USGS Earthquake Hazards Program",
"status": 200,
"api": "1.12.1",
"count": 58
},
"features": [
{
"type": "Feature",
"properties": {
"mag": 5.6,
"place": "63km S of Nishinoomote, Japan",
"time": 1631505067360,
"updated": 1631506295040,
"tz": null,
"url":
"https://earthquake.usgs.gov/earthquakes/eventpage/us7000j0ct",
"detail":
"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/us7000j0
ct.geojson",
"felt": null,
"cdi": null,
"mmi": null,
"alert": null,
"status": "reviewed",
"tsunami": 0,
"sig": 493,
"net": "us",
"code": "7000j0ct",
"ids": ",us7000j0ct,",
"sources": ",us,",
"types": ",geoserve,impact-text,nearby-cities,origin,phase-
data,scitech-link,shakemap,",
"nst": null,
"dmin": 0.452,
"rms": 0.87,
"gap": 40,
"magType": "mb",
"type": "earthquake",
"title": "M 5.6 - 63km S of Nishinoomote, Japan"
},
"geometry": {
"type": "Point",
"coordinates": [
130.7427,
29.8389,
28.78
]
},
"id": "us7000j0ct"
},
// Other earthquake features...
]
}

This JSON response provides information about earthquakes that


occurred between September 6, 2023, and September 13, 2023, with
a minimum magnitude of 5.0. It includes details such as earthquake
magnitude, location, time, and more for each earthquake event
within the specified time frame and magnitude threshold.

 JSON Output for Query 2

{
"type": "FeatureCollection",
"metadata": {
"generated": 1631382607000,
"url":
"https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&latit
ude=34.0522&longitude=-118.2437&maxradius=100",
"title": "USGS Earthquake Hazards Program",
"status": 200,
"api": "1.12.1",
"count": 13
},
"features": [
{
"type": "Feature",
"properties": {
"mag": 1.46,
"place": "1km SW of View Park-Windsor Hills, CA",
"time": 1631381914260,
"updated": 1631382130969,
"tz": null,
"url":
"https://earthquake.usgs.gov/earthquakes/eventpage/ci39914111",
"detail":
"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/ci39914111.ge
ojson",
"felt": null,
"cdi": null,
"mmi": null,
"alert": null,
"status": "reviewed",
"tsunami": 0,
"sig": 33,
"net": "ci",
"code": "39914111",
"ids": ",ci39914111,",
"sources": ",ci,",
"types": ",focal-mechanism,geoserve,nearby-cities,origin,phase-
data,scitech-link,",
"nst": 51,
"dmin": 0.08704,
"rms": 0.19,
"gap": 32,
"magType": "ml",
"type": "earthquake",
"title": "M 1.5 - 1km SW of View Park-Windsor Hills, CA"
},
"geometry": {
"type": "Point",
"coordinates": [
-118.3468333,
33.9883333,
14.53
]
},
"id": "ci39914111"
},
// Other earthquake features...
]
}

This JSON response provides information about earthquakes within a


100-mile radius of the specified latitude (34.0522) and longitude (-
118.2437). The response includes details such as earthquake
magnitude, location, time, and more for each earthquake event.

You might also like