Water Rights Data API End-point
Last updated
Last updated
Access Token. Please get in touch with the WaDE Team at WaDE_WSWC@hotmail.com to get an API access token. The token protects the API from bots and attacks. The WaDE team is planning to support a personalized token for each user as part of the WesDAAT user management system. We apologize for the inconvenience.
Water rights are now accessible through the Western States Water Data Access and Analysis Tool (WestDAAT). https://westdaat.westernstateswater.org/
You can also use the WaDE API to access water rights data across the West in a consistent JavaScript Object Notation (JSON) structure.
Click on the arrow next to the "response" block in the link below to see the API schema and an example response.
#!/usr/bin/env python
import pandas as pd
import numpy as np
import os
import json
from pandas.io.json import json_normalize
from urllib.request import urlopen
import gmaps
import gmaps.datasets
import plotly.express as px
# Access WaDE API to get the water allocations JSON
url = 'https://wade-api.azure-api.net/v1/SiteAllocationAmounts?State='
statesShort = ["CO", "UT", "WA", "OR", "CA", "OK", "ND", "AZ"]
df100_list = []
# extract target columns
subcolumns = ['WaterSourceUUID', 'Sites', 'AllocationAmount', 'AllocationMaximum',
'BeneficialUses']
for state in statesShort:
urlwithfilter = url+state
response = urlopen(urlwithfilter)
dataread = response.read().decode("utf-8")
data = json.loads(dataread)
df10 = json_normalize(data, 'Organizations')
df20 = pd.concat([pd.DataFrame(json_normalize(x)) for x in df10['WaterAllocations']],
ignore_index=True)
df30 = df20[subcolumns]
df100_list.append(df30)
df100 = pd.concat(df100_list, sort=True, ignore_index=True)
#df100.drop_duplicates(inplace=True)
print(len(df100.index))
df100.head(5)
# get a data frame that combines lat lon with allocation values
latloncolumns = ['WaterSourceUUID','Longitude', 'Latitude',
'AllocationAmount', 'AllocationMaximum', 'BeneficialUses']
df300 = pd.DataFrame(columns=latloncolumns)
jy = 0
for index, rows in df100.iterrows():
SitesL = rows.Sites
for latlon in SitesL:
#print(latlon)
df300.loc[jy,'WaterSourceUUID'] = rows.WaterSourceUUID
df300.loc[jy,'AllocationAmount'] = rows.AllocationAmount
df300.loc[jy,'AllocationMaximum'] = rows.AllocationMaximum
df300.loc[jy,'BeneficialUses'] = rows.BeneficialUses
df300.loc[jy,'Longitude'] = latlon['Longitude']
df300.loc[jy,'Latitude'] = latlon['Latitude']
jy += 1
print(len(df300.index))
df300.head(5)
# outdf100.WaterSourceUUID = df100['WaterSourceUUID']
print("Drop rows without lat lon values...")
df500 = df300.dropna(subset=['Longitude', 'Latitude'])
df500 = df500.reset_index(drop=True)
print(len(df500.index))
df500.head(5)
print("Drop duplicates if there are any...")
subCols = ['Longitude', 'Latitude']
df500.drop_duplicates(subset = subCols, inplace=True) #
df500 = df500.reset_index(drop=True)
print(len(df500.index))
df500.head(5)
# make sure the data are in the right data types
# plotly complained about allocation types being 'object'
print(df500.dtypes)
df500['AllocationAmount'] = pd.to_numeric(df500['AllocationAmount'], errors='coerce')
df500['AllocationMaximum'] = pd.to_numeric(df500['AllocationMaximum'], errors='coerce')
df500['Latitude'] = pd.to_numeric(df500['Latitude'], errors='coerce')
df500['Longitude'] = pd.to_numeric(df500['Longitude'], errors='coerce')
print(df500.dtypes)
# Plot allocation amount as a gmaps heatmap
APIKey = 'AI.......' # put your Google API key here
gmaps.configure(api_key=APIKey)
logan_coordinates = (41.6, -111.8)
denver_coordinates = (39.78, -104.59)
fig = gmaps.figure(map_type='HYBRID', center=denver_coordinates, zoom_level=4.5)
locations = df500[['Latitude', 'Longitude']]
#locations = locations[0:8701]
weights = df500['AllocationAmount']
#weights = weights1[0:8701]
fig.add_layer(gmaps.heatmap_layer(locations, weights=weights))
fig
print("Droping null amounts...")
df500purge = df500.loc[(df500["AllocationAmount"] == '') | (df500["AllocationAmount"] == np.nan)]
if len(df500purge.index) > 0:
dropIndex = df500.loc[(df500["AllocationAmount"] == '') | (df500["AllocationAmount"] == np.nan)].index
outdf100 = df500.drop(dropIndex)
outdf100 = df500.reset_index(drop=True)
print("Droping null max amounts...")
df500purge = df500.loc[(df500["AllocationMaximum"] == '') | (df500["AllocationMaximum"] == np.nan)]
if len(df500purge.index) > 0:
dropIndex = df500.loc[(df500["AllocationMaximum"] == '') | (df500["AllocationMaximum"] == np.nan)].index
outdf100 = df500.drop(dropIndex)
outdf100 = df500.reset_index(drop=True)
# plot allocation amount as plotly heatmap
#need to save your mapbox token file in the same dir
px.set_mapbox_access_token(open(".mapbox_token").read())
fig = px.scatter_mapbox(df500, lat="Latitude", lon="Longitude",
color="AllocationAmount", #size="AllocationMaximum",
color_continuous_scale=px.colors.cyclical.IceFire, size_max=5,
range_color=[0,1000],zoom=3, hover_data=["BeneficialUses"])
fig.show()
By passing in the appropriate options, you can search for available inventory in the system
search results matching criteria
const response = await fetch('https://wade-api.azure-api.net/v1/SiteAllocationAmounts', {
method: 'GET',
headers: {},
});
const data = await response.json();
{
"TotalWaterAllocationsCount": 1,
"Organizations": [
{
"OrganizationName": "UTDWR",
"OrganizationPurview": "Water rights administration, water planning, basin planning, water quality",
"OrganizationWebsite": "https://waterrights.utah.gov/",
"OrganizationPhoneNumber": "801-538-7240",
"OrganizationContactName": "Craig Miller",
"OrganizationContactEmail": "craigmiller@utah.gov",
"State": "Utah",
"Sites": [
{
"SiteName": "01-5567",
"SiteUUID": "UT-01-5567",
"NativeSiteID": "01-5567",
"USGSSiteID": "01-5567",
"SiteTypeCV": "01-5567",
"Longitude": "-112.158743",
"Latitude": "40.676523",
"PODorPOUSite": "POD",
"CoordinateMethodCV": "e.g., Digitized",
"CoordinateAccuracy": "Very accurate +/- 1 ft",
"WaterSources": [
{
"WaterSourceUUID": "123e4567-e89b-12d3-a456-426614174000",
"WaterSourceTypeCV": "text"
}
],
"SiteGeometry": "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))",
"NHDNetworkStatusCV": "Y",
"NHDProductCV": "NHD High Res.",
"NHDUpdateDate": "2016-08-29T09:12:33.001Z",
"NHDReachCode": "2867042",
"NHDMeasureNumber": "35.40000332",
"StateCV": "NHD High Res.",
"County": "Salt Lake",
"HUC8": "2025-02-05T04:50:45.450Z",
"HUC12": "2025-02-05T04:50:45.450Z"
}
],
"VariableSpecifics": [
{
"VariableSpecificTypeCV": "SiteSpecificWithdrawal",
"VariableCV": "SiteSpecificConsumptiveUse",
"AmountUnitCV": "cfs",
"AggregationStatisticCV": "average",
"AggregationInterval": "1",
"AggregationIntervalUnitCV": "month",
"ReportYearStartMonth": "10/01",
"ReportYearTypeCV": "irrigation year",
"MaximumAmountUnitCV": "acre feet"
}
],
"WaterSources": [
{
"WaterSourceName": "text",
"WaterSourceNativeID": "text",
"WaterSourceUUID": "123e4567-e89b-12d3-a456-426614174000",
"WaterSourceTypeCV": "text",
"FreshSalineIndicatorCV": "text",
"WaterSourceGeometry": "text"
}
],
"Methods": [
{
"MethodUUID": "UTDWRE-01",
"MethodName": "UTDWRE Water Withdrawal Estimation",
"MethodDescription": "A method for estimating water withdrawals by subarea",
"MethodNEMILink": "https://www.nemi.gov/methods/method_summary/10002/",
"ApplicableResourceType": "Groundwater and Surface Water",
"MethodTypeCV": "Estimated",
"DataCoverageValue": "85%",
"DataQualityValue": "QC600",
"DataConfidenceValue": "90%"
}
],
"BenificialUses": [
{
"BeneficialUseCategoryCV": "text",
"PrimaryUseCategoryCV": "text",
"USGSCategoryNameCV": "text",
"NAICSCodeNameCV": "text"
}
],
"WaterAllocations": [
{
"SiteUUID": "01-5567",
"SiteTypeCV": "01-5567",
"Longitude": "-112.158743",
"Latitude": "40.676523",
"CoordinateMethodCV": "e.g., Digitized",
"CoordinateAccuracy": "Very accurate +/- 1 ft",
"VariableSpecificTypeCV": "Water Allocation All",
"BeneficialUseCategoryCV": [
{
"BeneficialUseCategoryCV": "text"
}
],
"WaterSourceUUID": "UT-2210",
"WaterSourceTypeCV": "Surface water",
"MethodUUID": "text",
"AllocationNativeID": "102030",
"AllocationOwner": "John Doe",
"AllocationBasisCV": "John Doe",
"AllocationTypeCV": "Federal Reserved Water Right",
"AllocationApplicationDate": "2025-02-05",
"AllocationPriorityDate": "2025-02-05",
"AllocationLegalStatusCodeCV": "Perfected",
"AllocationExpirationDate": "2025-02-05",
"AllocationChangeApplicationIndicator": "Y",
"LegacyAllocationIDs": "01-2214, 01-2215, 01-2216",
"AllocationAcreage": "2016-08-29T09:12:33.001Z",
"AllocationTimeframeStart": "04/01",
"AllocationTimeframeEnd": "05/31",
"AllocationCropDutyAmount": "1.5",
"AllocationAmount": "10",
"AmountUnitCV": "cfs",
"AllocationMaximum": "300",
"MaximumAmountUnitCV": "cfs",
"PopulationServed": 10000,
"PowerGeneratedGWh": 5,
"AllocationCommunityWaterSupplySystem": "Salt Lake City",
"CustomerTypeCV": "Residential",
"AllocationSDWISIdentifierCV": "add one",
"AllocationGNISIDCV": "1442221",
"DataPublicationDate": "2016-08-29T09:12:33.001Z"
}
]
}
]
}