diff --git a/layers/dot-cams/README.md b/layers/dot-cams/README.md index 0852bcc..4ee53a9 100644 --- a/layers/dot-cams/README.md +++ b/layers/dot-cams/README.md @@ -5,71 +5,64 @@ Many states are through one of a few providers: * Castle Rock: https://www.castlerockits.com/oneweb * IBI Travel IQ: https://www.ibigroup.com/ibi-products/traveliq/ -### State list - -| State | DOT Name[^name] | Online Service Name | Still | Video | Web provider | Link | -| ----- | --------------- | ------------------- | ----- | ----- | ------------ | --------------------------------- | -| AK | DOT&PF | Alaska 511 | 111 | 0 | Travel IQ | https://511.alaska.gov/ | -| AL | ALDOT | algotraffic | 0 | 568 | custom | https://algotraffic.com/cameras | -| AR | ARDOT | | | | | | -| AZ | ADOT | AZ511 | 602 | 0 | Travel IQ | https://az511.com/ | -| CA | Caltrans | | | | | | -| CO | CDOT | COtrip | 832 | 686 | Castle Rock | https://maps.cotrip.org/ | -| CT | CTDOT | CTroads | 350 | 0 | Travel IQ | https://ctroads.org/ | -| DE | DelDOT | DelDOT Maps | 0 | 282 | Custom | https://deldot.gov/map/ | -| FL | FDOT | | | | | | -| GA | GDOT | 511GA | 1 | 3416 | Travel IQ | https://511ga.org/ | -| HI | HDOT | | | | | | -| IA | Iowa DOT | 511IA | 446 | 485 | Castle Rock | https://511ia.org/ | -| ID | ITD | Idaho 511 | 274 | 0 | Travel IQ | https://511.idaho.gov/ | -| IL | IDOT | | | | | | -| IN | IDOT | TrafficWise | 0 | 640 | Castle Rock | https://511in.org/ | -| KS | KDOT | KanDrive | 382 | 167 | Castle Rock | https://www.kandrive.gov/ | -| 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 | CHART | 0 | 538 | Custom | https://chart.maryland.gov/ | -| ME | MaineDOT | | | | | | -| MI | MDOT | | | | | | -| MN | MNDOT | 511MN | 647 | 1131 | Castle Rock | https://511mn.org/ | -| MO | MoDOT | | | | | https://traveler.modot.org/map/ | -| MS | MDOT | | | | | | -| MT | MDT | | | | | | -| NC | NCDOT | | | | | | -| ND | NDDOT | | | | | | -| NE | NDOT | Nebraska 511 | 919 | 0 | Castle Rock | https://new.511.nebraska.gov/ | -| NH | NHDOT | | | | | | -| NJ | NJDOT | | | | | | -| NM | NMDOT | | | | | | -| NV | NDOT | Nevada 511 | 0 | 606 | Travel IQ | https://www.nvroads.com/ | -| NY | NYSDOT | 511NY | 369 | 1272 | Travel IQ | https://www.511ny.org/ | -| OH | ODOT | | | | | | -| OK | ODOT | | | | | | -| OR | ODOT | | | | | | -| PA | PennDOT | | | | | | -| RI | RIDOT | | | | | | -| SC | SCDOT | | | | | | -| SD | SDDOT | | | | | | -| TN | TDOT | | | | | | -| TX | TxDOT | | | | | | -| UT | UDOT | UDOT Traffic | 0 | 1787 | Travel IQ | https://www.udottraffic.utah.gov/ | -| VA | VDOT | | | | | | -| VT | VTrans | | | | | | -| WA | WSDOT | | | | | | -| WI | WisDOT | 511WI | 0 | 468 | Travel IQ | https://511wi.gov/ | -| WV | WVDOT | | | | | | -| WY | WYDOT | | | | | | +| State | DOT Name[^name] | Online Service Name | Video? | Web provider | Link | +| ----- | --------------- | ------------------- | ------ | ------------ | ------------------------------- | +| AK | DOT&PF | | | Travel IQ | https://511.alaska.gov/ | +| AL | ALDOT | | | | | +| AR | ARDOT | | | | | +| AZ | ADOT | | | | | +| CA | Caltrans | | | | | +| CO | CDOT | | | | | +| CT | CTDOT | | | | | +| DE | DelDOT | | | | | +| FL | FDOT | | | | | +| GA | GDOT | | | | | +| HI | HDOT | | | | | +| IA | Iowa DOT | | | | | +| ID | ITD | | | | | +| IL | IDOT | | | | | +| IN | IDOT | | | | | +| KS | KDOT | | | | | +| KY | KYTC | | | | | +| LA | DOTD | | | | | +| MA | MassDOT | | | | | +| MD | MDOT | | | | | +| ME | MaineDOT | | | | | +| MI | MDOT | | | | | +| MN | MNDOT | 511MN | most | Castle Rock | https://511mn.org/ | +| MO | MoDOT | | | | https://traveler.modot.org/map/ | +| MS | MDOT | | | | | +| MT | MDT | | | | | +| NC | NCDOT | | | | | +| ND | NDDOT | | | | | +| NE | NDOT | | | | | +| NH | NHDOT | | | | | +| NJ | NJDOT | | | | | +| NM | NMDOT | | | | | +| NV | NDOT | | | | | +| NY | NYSDOT | | | | | +| OH | ODOT | | | | | +| OK | ODOT | | | | | +| OR | ODOT | | | | | +| PA | PennDOT | | | | | +| RI | RIDOT | | | | | +| SC | SCDOT | | | | | +| SD | SDDOT | | | | | +| TN | TDOT | | | | | +| TX | TxDOT | | | | | +| UT | UDOT | | | | | +| VA | VDOT | | | | | +| VT | VTrans | | | | | +| WA | WSDOT | | | | | +| WI | WisDOT | | | | | +| WV | WVDOT | | | | | +| WY | WYDOT | | | | | [^name]: From https://en.wikipedia.org/wiki/Department_of_transportation#List_of_U.S._state_and_insular_area_departments_of_transportation -### Non-State aligned -* New England 511 (https://newengland511.org/) consolidates Maine, New Hampshire, and Vermont into one site (341 photo/0 video/Travel IQ) - - -### Notes https://map.wyoroad.info/wtimap/index.html @@ -122,6 +115,8 @@ https://www.511virginia.org/ https://wv511.org/ +https://chart.maryland.gov/TrafficCameras/GetTrafficCameras + http://goakamai.org/cameras @@ -133,11 +128,14 @@ https://dot.ca.gov/programs/traffic-operations/traveler-information/511 "rr": "https://riverregion511.org" castlerock + +No video, only photos ?? + "ak": "https://511.alaska.gov/", + "az": "https://az511.com/", + "ct": "https://ctroads.org/", + "new england": "https://newengland511.org/", + "id": "https://511.idaho.gov/", + "ut": "https://www.udottraffic.utah.gov/", + Some kind of signature needed: "fl": "https://fl511.com/", - - -### Known data errors -- WI sure has a lot of cameras on null island -- Nebraska has one camera located in California -- Several workarounds documented in code diff --git a/layers/dot-cams/castle-rock/get_data.py b/layers/dot-cams/castle-rock/get_data.py index 1c811a8..4067bd7 100755 --- a/layers/dot-cams/castle-rock/get_data.py +++ b/layers/dot-cams/castle-rock/get_data.py @@ -65,11 +65,7 @@ for state, baseURL in states.items(): print(f"warn: Differing types detected: {c['views']}") if view['category'] == 'VIDEO': if state == "Nebraska": - # Nebraska has mislabeled a small amount of their data; - # there is one location with 4 views labeled as "VIDEO" - # which are not, in fact, video-containing views - view['category'] = "PHOTO" - continue + print(c) videoCount += 1 if len(view['sources']) != 1: raise Exception(f"Unexpected number of sources ({len(view['sources'])})") diff --git a/layers/dot-cams/de/get_data.py b/layers/dot-cams/de/get_data.py deleted file mode 100755 index 9458176..0000000 --- a/layers/dot-cams/de/get_data.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/python3 - -import requests -import json - -cameras = [] - -res = requests.get("https://tmc.deldot.gov/json/videocamera.json") -res.raise_for_status() -# { -# "timestamp": "2024-02-03T09:00:50Z", -# "timestampMS": "1706950850013", -# "version": "1.1", -# "uid": "-8569684966613574390", -# "status": "normal", -# "message": "", -# "cameraCount": 282, -# "cameraHash": "-1859423038", -# "videoCameras": [ -# { -# "urls": { -# "rtmp": "rtmpt://167.21.72.35:80/live/KCAM001.stream", -# "rtsp": "rtsp://167.21.72.35:554/live/KCAM001.stream", -# "f4m": "http://167.21.72.35:1935/live/KCAM001.stream/manifest.f4m", -# "m3u8": "http://167.21.72.35:1935/live/KCAM001.stream/playlist.m3u8", -# "m3u8s": "https://video.deldot.gov:443/live/KCAM001.stream/playlist.m3u8", -# "mssmooth": "http://167.21.72.35:1935/live/KCAM001.stream/Manifest" -# }, -# "id": "KCAM001", -# "title": "DE 1 @ MILFORD NECK ROAD (NORTH OFF)", -# "county": "Kent", -# "lat": 38.990771, -# "lon": -75.448487, -# "hash": "966393601", -# "enabled": true -# }, -# ... - -for c in res.json()['videoCameras']: - try: - if not c['enabled']: - print("warn: camera disabled; ignoring:", c) - continue - if not c['urls']['m3u8s'].startswith('https://'): - raise Exception("invalid hlsUrl") - cameras.append({ - "type": "Feature", - "geometry": { - "type": "Point", - "coordinates": [c['lon'], c['lat']], # yes, [lon, lat] since it's [x, y] - }, - "properties": { - "name": c['title'], - "views": [ - { - 'hasVideo': True, - 'src': c['urls']['m3u8s'], - }, - # { - # '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") diff --git a/layers/dot-cams/index.js b/layers/dot-cams/index.js index 166c0ec..1d5ee46 100644 --- a/layers/dot-cams/index.js +++ b/layers/dot-cams/index.js @@ -13,8 +13,6 @@ import pinVideo from './pin-video.svg?url'; // TODO: remove `?url`? 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,8 +20,6 @@ const allStates = { ...castleRockStates, ...travelIqStates, 'Alabama': al, - 'Delaware': de, - 'Maryland': md, }; let dot_cams = { diff --git a/layers/dot-cams/md/get_data.py b/layers/dot-cams/md/get_data.py deleted file mode 100755 index 402b405..0000000 --- a/layers/dot-cams/md/get_data.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/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") diff --git a/layers/dot-cams/travel-iq/get_data.py b/layers/dot-cams/travel-iq/get_data.py index ad5ff15..29f49e1 100755 --- a/layers/dot-cams/travel-iq/get_data.py +++ b/layers/dot-cams/travel-iq/get_data.py @@ -4,16 +4,10 @@ import requests import json states = { - "Alaska": "https://511.alaska.gov/", - "Arizona": "https://az511.com/", - "Connecticut": "https://ctroads.org/", "Georgia": "https://511ga.org/", - "Idaho": "https://511.idaho.gov/", "Louisiana": "https://www.511la.org/", "Nevada": "https://www.nvroads.com/", - "NewEngland": "https://newengland511.org/", "NewYork": "https://www.511ny.org/", - "Utah": "https://www.udottraffic.utah.gov/", "Wisconsin": "https://511wi.gov/" } @@ -52,36 +46,18 @@ for state, baseURL in states.items(): "length": 100, } - video_camera_count = 0 - still_camera_count = 0 - cameras = [] available_cameras = 999_999 # lots while len(cameras) < available_cameras: - if state == "Connecticut": - # gotta be a special snowflake I guess? - res = requests.post(f"{baseURL}/List/GetData/Cameras", json={"draw":1,"columns":[{"data":"sortId","name":"sortId","searchable":True,"orderable":True,"search":{"value":"","regex":False}},{"data":"cityName","name":"cityName","searchable":True,"orderable":True,"search":{"value":"","regex":False}},{"data":"roadway","name":"roadway","searchable":True,"orderable":True,"search":{"value":"","regex":False}},{"data":"sortIdDisplay","name":"sortIdDisplay","searchable":True,"orderable":True,"search":{"value":"","regex":False}},{"data":"description1","name":"description1","searchable":False,"orderable":True,"search":{"value":"","regex":False}},{"data":"direction","name":"direction","searchable":False,"orderable":False,"search":{"value":"","regex":False}},{"data":6,"name":"","searchable":False,"orderable":False,"search":{"value":"","regex":False}}],"order":[{"column":0,"dir":"asc"},{"column":1,"dir":"asc"}],"start":0,"length":10,"search":{"value":"","regex":False}}) - else: - res = requests.get(f"{baseURL}/List/GetData/Cameras", { - "query": json.dumps(query), - "lang": "en", - }) + res = requests.get(f"{baseURL}/List/GetData/Cameras", { + "query": json.dumps(query), + "lang": "en", + }) res.raise_for_status() res = res.json() available_cameras = res['recordsTotal'] for c in res['data']: - if 'videoUrl' in c and isinstance(c['videoUrl'], list): # LA returns multiple (identical?) streams - src = c['videoUrl'][0] - video_camera_count += 1 - elif 'videoUrl' in c and c['videoUrl'] and c['videoUrl'] != '0': - # Yeah, Idaho has a single camera where videoURL = '0'. Nice. - src = c['videoUrl'] - video_camera_count += 1 - else: - src = baseURL + "map/Cctv/" + c['id'] - still_camera_count += 1 - cameras.append({ "type": "Feature", "geometry": { @@ -91,8 +67,8 @@ for state, baseURL in states.items(): "properties": { 'name': c['displayName'], 'views': [{ - 'hasVideo': 'videoUrl' in c and bool(c['videoUrl']), - 'src': src, + 'hasVideo': c['videoUrl'], + 'src': c['videoUrl'][0] if isinstance(c['videoUrl'], list) else c['videoUrl'], # LA returns multiple (identical?) streams }], }, }) @@ -107,7 +83,6 @@ for state, baseURL in states.items(): f.write(json.dumps(geojson)) print(f"{len(cameras)} locations found for {state}") - print(f"{state}: {still_camera_count} photo + {video_camera_count} video cameras") # hack hack hack #