Add Maryland DOT cameras

main
Chandler Swift 2024-02-03 03:30:10 -06:00
parent a0675bc376
commit cc4a8cca8e
Signed by: chandlerswift
GPG Key ID: A851D929D52FB93F
3 changed files with 77 additions and 3 deletions

View File

@ -28,7 +28,7 @@ Many states are through one of a few providers:
| KY | KYTC | | | | | | | KY | KYTC | | | | | |
| LA | DOTD | 511 | 0 | 288 | Travel IQ | https://www.511la.org/ | | LA | DOTD | 511 | 0 | 288 | Travel IQ | https://www.511la.org/ |
| MA | MassDOT | Mass511 | 20 | 225 | Castle Rock | https://mass511.com/ | | MA | MassDOT | Mass511 | 20 | 225 | Castle Rock | https://mass511.com/ |
| MD | MDOT | | | | | | | MD | MDOT | CHART | 0 | 538 | Custom | https://chart.maryland.gov/ |
| ME | MaineDOT | | | | | | | ME | MaineDOT | | | | | |
| MI | MDOT | | | | | | | MI | MDOT | | | | | |
| MN | MNDOT | 511MN | 647 | 1131 | Castle Rock | https://511mn.org/ | | MN | MNDOT | 511MN | 647 | 1131 | Castle Rock | https://511mn.org/ |
@ -122,8 +122,6 @@ https://www.511virginia.org/
https://wv511.org/ https://wv511.org/
https://chart.maryland.gov/TrafficCameras/GetTrafficCameras
http://goakamai.org/cameras http://goakamai.org/cameras

View File

@ -14,6 +14,7 @@ import castleRockStates from './castle-rock/data/states.js';
import travelIqStates from './travel-iq/data/states.js'; import travelIqStates from './travel-iq/data/states.js';
import al from './al/data.geojson?url'; import al from './al/data.geojson?url';
import de from './de/data.geojson?url'; import de from './de/data.geojson?url';
import md from './md/data.geojson?url';
import dot_names from './layer_names.js'; import dot_names from './layer_names.js';
@ -22,6 +23,7 @@ const allStates = {
...travelIqStates, ...travelIqStates,
'Alabama': al, 'Alabama': al,
'Delaware': de, 'Delaware': de,
'Maryland': md,
}; };
let dot_cams = { let dot_cams = {

View File

@ -0,0 +1,74 @@
#!/usr/bin/python3
import requests
import json
cameras = []
res = requests.get("https://chartexp1.sha.maryland.gov/CHARTExportClientService/getCameraMapDataJSON.do")
res.raise_for_status()
# {
# "error": null,
# "data": [
# {
# "description": "I-270 & Old Hundred Rd (MD 109)(CAM 165)",
# "lat": 39.2773,
# "lon": -77.3236,
# "cctvIp": "strmr5.sha.maryland.gov",
# "milePost": 22.27,
# "cameraCategories": [
# "Wash. DC"
# ],
# "routeNumber": 270,
# "commMode": "ONLINE",
# "routePrefix": "IS",
# "routeSuffix": "",
# "opStatus": "OK",
# "publicVideoURL": "https://chart.maryland.gov/Video/GetVideo/7a00a1dc01250075004d823633235daa",
# "lastCachedDataUpdateTime": 1706950514352,
# "name": "I-270 & Old Hundred Rd (MD 109)",
# "id": "7a00a1dc01250075004d823633235daa"
# },
for c in res.json()['data']:
try:
# # 50-ish are marginal; let's ignore that and put 'em on the map anyway
# if not c['commMode'] == "ONLINE":
# print("warn: camera offline; ignoring:", c)
# continue
# if not c['opStatus'] == "OK":
# print("warn: camera not ok; ignoring:", c)
# continue
cameras.append({
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [c['lon'], c['lat']], # yes, [lon, lat] since it's [x, y]
},
"properties": {
"name": c['description'],
"views": [
{
'hasVideo': True,
'src': f"https://{c['cctvIp']}/rtplive/{c['id']}/playlist.m3u8",
},
# {
# 'hasVideo': False,
# 'src': c['imageUrl'],
# }
]
},
})
except Exception as e:
print(c)
raise e
geojson = {
"type": "FeatureCollection",
"features": cameras,
}
with open("data.geojson", "w") as f:
f.write(json.dumps(geojson))
print(f"{len(cameras)} locations found")