GetEarthquakeProbability API
For a specified location, the GetEarthquakeProbability API returns:
-
The latitude and longitude of the location.
-
The current expected rate of earthquakes of specified magnitude over a specified time window.
-
The current expected probability of experiencing at least one such earthquake.
The GetEarthquakeProbability Web Service is located at: http://api.openhazards.com/GetEarthquakeProbability.
The parameters of the API are:
| Parameter | Description | Required |
|---|---|---|
| q | The geographical location to query. This can be a city name, street address, etc. The parameter type is a text string. |
Yes |
| w | The calculation window (in days) for the forecast. The parameter type is an integer. Default value: 365 (1 year). |
No |
| m |
The magnitude threshold for the forecast. The parameter type is a float. Default value: 6.0. | No |
| r |
The calculation radius (in km) for the forecast. The parameter type is an integer. Default value: 50 (approximately 31 miles) . | No |
The results returned by the API are:
| Parameter | Description |
|---|---|
| location |
The resulting parsed location for the calculation:
|
| forecast |
The calculation results:
|
Messages and Codes:
The following table summarizes possible return codes from the API:
| Error Code | Description | Resolution |
|---|---|---|
| 0 | No location was specified |
Check if you have provided a geographical location in your API call. |
| 1 | Location could not be found | Check the provided geographical location for spelling mistakes. |
Example
The following request will return the probability of a magnitude 6.8 earthquake occurring within 100km of San Francisco over the next 365 days.
Request:
http://api.openhazards.com/GetEarthquakeProbability?q=San+Francisco,+CA&m=6.8&r=100
Response:
<xmlresponse>
<location>
<place>San Francisco, CA, USA</place>
<lat>39.150000</lat>
<lng>-122.419415</lng>
<radius unit="km">100.000000</radius>
</location>
<forecast>
<window unit="days">365</window>
<mag>6.8</mag>
<rate>0.00930218047778</rate>
<prob>0.93%</prob>
</forecast>
</xmlresponse>
