How to Use the US Precipitation Date Range API
The US Precipitation Date Range API by GeoRiskServices allows users to retrieve precipitation data for a specified date range at a given location. This API is ideal for weather analysis, agricultural planning, and environmental studies.
API Endpoint
The API is accessible at the following endpoint:
https://www.allthingsdev.co/apimarketplace/endpoints/geo-risk-services/67b9249d563cbd684a8bf1fc
JSON Schema Overview
Required Parameters
The API requires the following input:
- Latitude and Longitude:
lat
: Latitude (number, between -90 and 90).lon
: Longitude (number, between -180 and 180).- or::
- address: string, one-line format (“235 2nd St, San Francisco, CA 94105”)
- Date Range:
start_date
: Start date inYYYY-MM-DD
format.end_date
: End date inYYYY-MM-DD
format.
Optional Parameters
units
: String – Unit for temperature measurement ("f"
or"c"
). Default:"f"
.- perf: boolean – return db & api performance metrics.
- anno: boolean – return system annotations.
Example Schema
The API accepts either address or a combination of latitude & longitude.
{
"lat": 34.052235,
"lon": -118.243683,
"perf" : true,
"anno" : true,
"units" : "f",
"start_date" : "2024-01-01",
"end_date" : "2024-02-01"
}
{
"address": "235 2nd St, San Francisco, CA 94105",
"perf" : true,
"anno" : true,
"units" : "f",
"start_date" : "2024-01-01",
"end_date" : "2024-02-01"
}
Step-by-Step Guide to Using the API
Step 1: Prepare Your Request
Choose the geographic coordinates (lat
, lon
) and specify the date range (start_date
, end_date
).
Step 2: Send a POST Request
Send a POST request to the API endpoint with the JSON payload.
Example Request with Lat/Lon:
curl --location 'https://Geo-Risk-Services.proxy-production.allthingsdev.co/ustempdaterange' \
--header 'Content-Type: application/json' \
--header 'x-apihub-key: fj1jXaBtgygVVeOXYx6F1mNcd70F00XmnLnbEvGnNr831j-t5f' \
--header 'x-apihub-host: Geo-Risk-Services.allthingsdev.co' \
--header 'x-apihub-endpoint: 56132f9f-38e6-435c-9851-0c716f8db8de' \
--header 'Content-Type: application/json' \
--data '{
"lat": 34.052235,
"lon": -118.243683,
"perf" : true,
"anno" : true,
"units" : "f",
"start_date" : "2024-01-01",
"end_date" : "2024-02-01"
}'
Example Request with Address:
curl --location 'https://Geo-Risk-Services.proxy-production.allthingsdev.co/ustempdaterange' \
--header 'Content-Type: application/json' \
--header 'x-apihub-key: fj1jXaBtgygVVeOXYx6F1mNcd70F00XmnLnbEvGnNr831j-t5f' \
--header 'x-apihub-host: Geo-Risk-Services.allthingsdev.co' \
--header 'x-apihub-endpoint: 56132f9f-38e6-435c-9851-0c716f8db8de' \
--header 'Content-Type: application/json' \
--data '{
"address": "235 2nd St, San Francisco, CA 94105",
"perf" : true,
"anno" : true,
"units" : "f",
"start_date" : "2024-01-01",
"end_date" : "2024-02-01"
}'
Step 3: Interpret the Response
The API responds with precipitation data for the specified date range.
Example Lat/Lon Response:
{
"status": "success",
"db_perf_ms": 61,
"api_perf_ms": 811,
"error": "",
"max_temp_dt": "2024-12-03",
"input_params": {
"lat": 37.786045080006,
"lon": -122.397232161538,
"address": "235 2nd St, San Francisco, CA 94105",
"perf": true,
"anno": true,
"units": "f",
"start_dt": "2024-01-01",
"end_dt": "2024-02-01"
},
"results": [
{
"units": "F",
"temp_avg": 52.25,
"temp_max": 56.75,
"temp_min": 47.76,
"temp_date": "2024-01-01"
},
{
"units": "F",
"temp_avg": 53.56,
"temp_max": 60.14,
"temp_min": 46.98,
"temp_date": "2024-01-02"
},
{
"units": "F",
"temp_avg": 52.63,
"temp_max": 58.72,
"temp_min": 46.54,
"temp_date": "2024-01-03"
},
{
"units": "F",
"temp_avg": 52.26,
"temp_max": 57.2,
"temp_min": 47.34,
"temp_date": "2024-01-04"
},
{
"units": "F",
"temp_avg": 54.05,
"temp_max": 60.88,
"temp_min": 47.19,
"temp_date": "2024-01-05"
},
{
"units": "F",
"temp_avg": 52.5,
"temp_max": 59.84,
"temp_min": 45.18,
"temp_date": "2024-01-06"
},
{
"units": "F",
"temp_avg": 48.72,
"temp_max": 54.96,
"temp_min": 42.48,
"temp_date": "2024-01-07"
},
{
"units": "F",
"temp_avg": 48.72,
"temp_max": 55.72,
"temp_min": 41.72,
"temp_date": "2024-01-08"
},
{
"units": "F",
"temp_avg": 49.73,
"temp_max": 56.68,
"temp_min": 42.79,
"temp_date": "2024-01-09"
},
{
"units": "F",
"temp_avg": 49.49,
"temp_max": 54.25,
"temp_min": 44.74,
"temp_date": "2024-01-10"
},
{
"units": "F",
"temp_avg": 48.48,
"temp_max": 52.95,
"temp_min": 44.01,
"temp_date": "2024-01-11"
},
{
"units": "F",
"temp_avg": 49.42,
"temp_max": 56.54,
"temp_min": 42.31,
"temp_date": "2024-01-12"
},
{
"units": "F",
"temp_avg": 48.59,
"temp_max": 54.19,
"temp_min": 43.01,
"temp_date": "2024-01-13"
},
{
"units": "F",
"temp_avg": 49.73,
"temp_max": 53.98,
"temp_min": 45.49,
"temp_date": "2024-01-14"
},
{
"units": "F",
"temp_avg": 52.19,
"temp_max": 58.27,
"temp_min": 46.15,
"temp_date": "2024-01-15"
},
{
"units": "F",
"temp_avg": 50.59,
"temp_max": 55.79,
"temp_min": 45.39,
"temp_date": "2024-01-16"
},
{
"units": "F",
"temp_avg": 50.56,
"temp_max": 55.79,
"temp_min": 45.32,
"temp_date": "2024-01-17"
},
{
"units": "F",
"temp_avg": 54.46,
"temp_max": 59.62,
"temp_min": 49.31,
"temp_date": "2024-01-18"
},
{
"units": "F",
"temp_avg": 52.05,
"temp_max": 57.16,
"temp_min": 46.93,
"temp_date": "2024-01-19"
},
{
"units": "F",
"temp_avg": 52.25,
"temp_max": 57.06,
"temp_min": 47.44,
"temp_date": "2024-01-20"
},
{
"units": "F",
"temp_avg": 54.78,
"temp_max": 58.93,
"temp_min": 50.65,
"temp_date": "2024-01-21"
},
{
"units": "F",
"temp_avg": 56.37,
"temp_max": 59.52,
"temp_min": 53.23,
"temp_date": "2024-01-22"
},
{
"units": "F",
"temp_avg": 55.19,
"temp_max": 59.41,
"temp_min": 50.94,
"temp_date": "2024-01-23"
},
{
"units": "F",
"temp_avg": 55.13,
"temp_max": 59.11,
"temp_min": 51.15,
"temp_date": "2024-01-24"
},
{
"units": "F",
"temp_avg": 54.22,
"temp_max": 58.3,
"temp_min": 50.11,
"temp_date": "2024-01-25"
},
{
"units": "F",
"temp_avg": 55.12,
"temp_max": 59.76,
"temp_min": 50.46,
"temp_date": "2024-01-26"
},
{
"units": "F",
"temp_avg": 53.56,
"temp_max": 57.69,
"temp_min": 49.47,
"temp_date": "2024-01-27"
},
{
"units": "F",
"temp_avg": 56.44,
"temp_max": 63.64,
"temp_min": 49.27,
"temp_date": "2024-01-28"
},
{
"units": "F",
"temp_avg": 58.69,
"temp_max": 65.24,
"temp_min": 52.14,
"temp_date": "2024-01-29"
},
{
"units": "F",
"temp_avg": 61.08,
"temp_max": 69.22,
"temp_min": 52.95,
"temp_date": "2024-01-30"
},
{
"units": "F",
"temp_avg": 57.9,
"temp_max": 63.82,
"temp_min": 51.98,
"temp_date": "2024-01-31"
},
{
"units": "F",
"temp_avg": 55.53,
"temp_max": 57.96,
"temp_min": 53.09,
"temp_date": "2024-02-01"
}
],
"annotations": [
{
"org": "US Census",
"org_link": "https://www.census.gov/",
"data_service": "https://geocoding.geo.census.gov/geocoder/",
"grs_last_udpate": "2024-08-17T22:22:32.631807+00:00"
},
{
"org": "US NCEI - NOAA",
"org_link": "https://www.ncei.noaa.gov/",
"data_service": "https://console.cloud.google.com/storage/browser/noaa-ncei-nclimgrid-daily/cog/2024;tab=objects?pageState=(%22StorageObjectListTable%22:(%22f%22:%22%255B%255D%22))&prefix=&forceOnObjectsSortingFiltering=false&invt=AbjC2w&inv=1",
"grs_last_udpate": null
},
{
"org": "USGS",
"org_link": "https://www.usgs.gov",
"data_service": "https://apps.nationalmap.gov/epqs/",
"grs_last_udpate": "2024-09-01T01:25:43.77738+00:00"
}
]
}
total_precipitation
: Total precipitation for the specified date range.unit
: Measurement unit (e.g., inches, mm).date_range
: Start and end dates of the requested period.
Use Cases
- Agricultural Planning: Estimate precipitation levels for crop planning.
- Environmental Research: Analyze precipitation trends over a period.
- Urban Planning: Assess rainfall impacts on infrastructure.
Tips for Efficient Use
- Ensure the date range is valid and within historical data limits.
- Use appropriate units (
"inches"
or"mm"
) depending on your analysis needs. - Combine precipitation data with other GeoRiskServices APIs for comprehensive geospatial risk assessments.
The US Precipitation Date Range API is a versatile tool for weather-related insights and decision-making.