Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions data/gauges.geojson
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"lid":"FCTV2","name":"Falling Creek at Turner Road near Ampt Hill","rfc":{"abbreviation":"MARFC","name":"Middle Atlantic River Forecast Center"},"wfo":{"abbreviation":"AKQ","name":"Wakefield"},"state":{"abbreviation":"VA","name":"Virginia"},"latitude":37.45011,"longitude":-77.5111,"pedts":{"observed":"HGIRR","forecast":""},"status":{"observed":{"primary":5.62,"primaryUnit":"ft","secondary":-999,"secondaryUnit":"kcfs","floodCategory":"not_defined","validTime":"2026-06-06T14:15:00Z"},"forecast":{"primary":-999,"primaryUnit":"","secondary":-999,"secondaryUnit":"","floodCategory":"fcst_not_current","validTime":"0001-01-01T00:00:00Z"}}},"geometry":{"type":"Point","coordinates":[-77.5111,37.45011]}},{"type":"Feature","properties":{"lid":"FHRV2","name":"Falling Creek at Hopkins Rd near Ampt Hill","rfc":{"abbreviation":"MARFC","name":"Middle Atlantic River Forecast Center"},"wfo":{"abbreviation":"AKQ","name":"Wakefield"},"state":{"abbreviation":"VA","name":"Virginia"},"latitude":37.461048,"longitude":-77.466148,"pedts":{"observed":"HGIRR","forecast":""},"status":{"observed":{"primary":6.58,"primaryUnit":"ft","secondary":-999,"secondaryUnit":"kcfs","floodCategory":"not_defined","validTime":"2026-06-06T14:15:00Z"},"forecast":{"primary":-999,"primaryUnit":"","secondary":-999,"secondaryUnit":"","floodCategory":"fcst_not_current","validTime":"0001-01-01T00:00:00Z"}}},"geometry":{"type":"Point","coordinates":[-77.466148,37.461048]}},{"type":"Feature","properties":{"lid":"JRKV2","name":"James River (VA) at KANAWHA CANAL near Richmond","rfc":{"abbreviation":"MARFC","name":"Middle Atlantic River Forecast Center"},"wfo":{"abbreviation":"AKQ","name":"Wakefield"},"state":{"abbreviation":"VA","name":"Virginia"},"latitude":37.564444444444,"longitude":-77.574444444444,"pedts":{"observed":"HGIRG","forecast":"HGIFE"},"status":{"observed":{"primary":6.65,"primaryUnit":"ft","secondary":0.137,"secondaryUnit":"kcfs","floodCategory":"not_defined","validTime":"2026-06-06T13:30:00Z"},"forecast":{"primary":-999,"primaryUnit":"","secondary":-999,"secondaryUnit":"","floodCategory":"fcst_not_current","validTime":"0001-01-01T00:00:00Z"}}},"geometry":{"type":"Point","coordinates":[-77.574444444444,37.564444444444]}},{"type":"Feature","properties":{"lid":"PCFV2","name":"Pocoshock Creek at Rt 360 near Falling Creek Farms","rfc":{"abbreviation":"MARFC","name":"Middle Atlantic River Forecast Center"},"wfo":{"abbreviation":"AKQ","name":"Wakefield"},"state":{"abbreviation":"VA","name":"Virginia"},"latitude":37.46444,"longitude":-77.53854,"pedts":{"observed":"HGIRR","forecast":""},"status":{"observed":{"primary":6.29,"primaryUnit":"ft","secondary":-999,"secondaryUnit":"kcfs","floodCategory":"not_defined","validTime":"2026-06-06T14:15:00Z"},"forecast":{"primary":-999,"primaryUnit":"","secondary":-999,"secondaryUnit":"","floodCategory":"fcst_not_current","validTime":"0001-01-01T00:00:00Z"}}},"geometry":{"type":"Point","coordinates":[-77.53854,37.46444]}},{"type":"Feature","properties":{"lid":"RCBV2","name":"Broad Rock Creek at Rt 1 at Richmond","rfc":{"abbreviation":"MARFC","name":"Middle Atlantic River Forecast Center"},"wfo":{"abbreviation":"AKQ","name":"Wakefield"},"state":{"abbreviation":"VA","name":"Virginia"},"latitude":37.487246,"longitude":-77.444991,"pedts":{"observed":"HGIRR","forecast":""},"status":{"observed":{"primary":3.55,"primaryUnit":"ft","secondary":-999,"secondaryUnit":"kcfs","floodCategory":"not_defined","validTime":"2026-06-06T14:30:00Z"},"forecast":{"primary":-999,"primaryUnit":"","secondary":-999,"secondaryUnit":"","floodCategory":"fcst_not_current","validTime":"0001-01-01T00:00:00Z"}}},"geometry":{"type":"Point","coordinates":[-77.444991,37.487246]}},{"type":"Feature","properties":{"lid":"RICV2","name":"James River (VA) at Richmond Locks","rfc":{"abbreviation":"MARFC","name":"Middle Atlantic River Forecast Center"},"wfo":{"abbreviation":"AKQ","name":"Wakefield"},"state":{"abbreviation":"VA","name":"Virginia"},"latitude":37.525,"longitude":-77.421111111111,"pedts":{"observed":"HGIRG","forecast":"HGIFF"},"status":{"observed":{"primary":1.5,"primaryUnit":"ft","secondary":-999,"secondaryUnit":"kcfs","floodCategory":"no_flooding","validTime":"2026-06-06T13:54:00Z"},"forecast":{"primary":2.5,"primaryUnit":"ft","secondary":-999,"secondaryUnit":"kcfs","floodCategory":"no_flooding","validTime":"2026-06-09T03:00:00Z"}}},"geometry":{"type":"Point","coordinates":[-77.421111111111,37.525]}},{"type":"Feature","properties":{"lid":"RMDV2","name":"James River (VA) at Richmond-Westham","rfc":{"abbreviation":"MARFC","name":"Middle Atlantic River Forecast Center"},"wfo":{"abbreviation":"AKQ","name":"Wakefield"},"state":{"abbreviation":"VA","name":"Virginia"},"latitude":37.563055555556,"longitude":-77.547222222222,"pedts":{"observed":"HGIRG","forecast":"HGIFF"},"status":{"observed":{"primary":4.03,"primaryUnit":"ft","secondary":1.91,"secondaryUnit":"kcfs","floodCategory":"no_flooding","validTime":"2026-06-06T13:30:00Z"},"forecast":{"primary":4,"primaryUnit":"ft","secondary":1.85,"secondaryUnit":"kcfs","floodCategory":"no_flooding","validTime":"2026-06-06T18:00:00Z"}}},"geometry":{"type":"Point","coordinates":[-77.547222222222,37.563055555556]}}]}
16 changes: 16 additions & 0 deletions gauges.ultra
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
type: geojson
transform: |
export default (data) => ({
type: "FeatureCollection",
features: data.gauges.map(g => ({
type: "Feature",
properties: g,
geometry: {
type: "Point",
coordinates: [g.longitude, g.latitude],
},
})),
})
---
https://api.water.noaa.gov/nwps/v1/gauges?bbox.xmin=-77.60205967932723&bbox.ymin=37.441871701544855&bbox.xmax=-77.31705491509821&bbox.ymax=37.62441381867703&srid=EPSG_4326
25 changes: 24 additions & 1 deletion map.ultra
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ style:
fill-color: gray
fill-opacity: 0.5
beforeLayerId: building
- type: symbol
filter: [==, [get, type], streamgauge]
icon-image: pinhead:circle_outline_with_top_left_quarter_and_bottom_right_quarter
icon-overlap: always
#icon-color:
# - case
# - [ ==, [ get, cso_now ], true ]
# - darkred
# - [ ==, [ get, cso_active ], true ]
# - red
# - [ ==, [ get, cso_recent ], true ]
# - orange
# - green
- type: symbol
filter: [==, [get, type], test]
icon-image: pinhead:circle
Expand Down Expand Up @@ -100,8 +113,9 @@ export const source = async () => {
fetch("https://poop.maprva.org/data/cso_overflow.geojson"),
fetch("https://poop.maprva.org/data/james_river_watch.geojson"),
fetch("https://poop.maprva.org/data/water.geojson"),
fetch("https://api.water.noaa.gov/nwps/v1/gauges?bbox.xmin=-77.60205967932723&bbox.ymin=37.51971667627613&bbox.xmax=-77.31705491509821&bbox.ymax=37.62441381867703&srid=EPSG_4326"),
]);
const [cso, testResults, water] = await Promise.all(resps.map(r => r.json()));
const [cso, testResults, water, gauges] = await Promise.all(resps.map(r => r.json()));

// get just the latest test results and compute their age
const latestTestResults = testResults.features.reduce((acc, cur) => {
Expand All @@ -120,7 +134,16 @@ export const source = async () => {
...Object.values(latestTestResults),
...cso.features,
...water.features,
...gauges.gauges.map(g => ({
type: "Feature",
properties: {...g, type: "streamgauge"},
geometry: {
type: "Point",
coordinates: [g.longitude, g.latitude],
},
})),
],
};
return { type: "geojson", data };
}