Add Maryland DOT cameras

This commit is contained in:
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 | | | | | |
| LA | DOTD | 511 | 0 | 288 | Travel IQ | https://www.511la.org/ |
| MA | MassDOT | Mass511 | 20 | 225 | Castle Rock | https://mass511.com/ |
| MD | MDOT | | | | | |
| MD | MDOT | CHART | 0 | 538 | Custom | https://chart.maryland.gov/ |
| ME | MaineDOT | | | | | |
| MI | MDOT | | | | | |
| MN | MNDOT | 511MN | 647 | 1131 | Castle Rock | https://511mn.org/ |
@ -122,8 +122,6 @@ https://www.511virginia.org/
https://wv511.org/
https://chart.maryland.gov/TrafficCameras/GetTrafficCameras
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 al from './al/data.geojson?url';
import de from './de/data.geojson?url';
import md from './md/data.geojson?url';
import dot_names from './layer_names.js';
@ -22,6 +23,7 @@ const allStates = {
...travelIqStates,
'Alabama': al,
'Delaware': de,
'Maryland': md,
};
let dot_cams = {

74
layers/dot-cams/md/get_data.py Executable file
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")