This project is a web application that provides notifications for Automated Speed Enforcement (ASE) locations in Toronto. The application uses Leaflet.js to display a map with ASE locations and provides real-time notifications when the user is near an active speed camera.
- Improve accuracy of camera detection
- Handle edge cases where cameras are not detected
- Optimize performance for faster camera data processing
The application fetches ASE location data from the City of Toronto's Open Data portal and displays the locations on a map. It uses an api I created to return streetname given coordinates. If user is in range o the camera and on the same street, user is alerted. If a vehicle is detected by the ASE system travelling in excess of the posted speed limit, the registered owner of the vehicle will receive a violation notice regardless of who was driving. The total payable amount is determined by Ontario Regulation 355/22 under the Highway Traffic Act and includes a Set Fine, victim fund component, and a provincial licence plate access fee. No demerit points will be issued by the Ministry of Transportation and no one’s driving record will be impacted.
As of December 2022, Toronto's Automated Speed Enforcement (ASE) program had collected $34 million in fines from speed cameras.
- Flask (Python web framework)
- Leaflet.js (Interactive maps)
- Bootstrap (UI components)
- toronto-street-api (Street name detection)
- City of Toronto Open Data API (Camera locations)
When in range and on same street (300m radius from your location and 300m radius from camera radius overlaps) page will flash red 🟥 with optional audio alert 🔊.
The ASE location data is obtained from the City of Toronto's Open Data portal. The dataset can be found at Automated Speed Enforcement Locations.
- Open the application in your browser.
- Allow the application to access your location.
- The map will display ASE locations in Toronto.
- If you are near an active speed camera, the site will flash red.
- If the sound alert is enabled, it will continue to notify you while running in the background, allowing you to use your preferred navigation app uninterrupted.
The application uses a street name matching system that you can monitor through the browser console:
--- Checking proximity ---
Street name normalization: "Beverley Street" -> "beverley street"
Current location (normalized): beverley street (original: Beverley Street) [Confidence: 26] [Confirmed: beverley street]
Camera in range: Beverley St. Near D'Arcy St. (46m)
Checking camera: "Beverley St. Near D'Arcy St." at 46m
Street name normalization: "Beverley St. Near D'Arcy St." -> "beverley street"
Comparing normalized streets: "beverley street" with "beverley street"
MATCH! On same street as camera: Beverley St. Near D'Arcy St., distance: 46m
Warning activated - Street confidence: 26
-
Street Normalization
- Original street names are normalized to remove variations
- Example:
"Beverley Street" -> "beverley street"
- Removes periods, standardizes abbreviations (St. -> Street)
-
Confidence System
[Confidence: 26]
shows how many consecutive times you've been on this street- Higher confidence means more reliable detection
[Confirmed: beverley street]
shows the current confirmed street name
-
Camera Detection
- Shows nearby cameras within 200m radius
- Example:
Camera in range: Beverley St. Near D'Arcy St. (46m)
- Distance is shown in meters
-
Street Matching
- Compares normalized street names for matches
- Shows both the original and normalized versions
- Must match exactly after normalization
"No location data available"
- GPS position not yet received"Invalid street name detected"
- Location returned a business name or invalid street"Street changed from X to Y"
- Detected movement to a different street"Safe - Warning deactivated"
- No longer near any cameras
If you see these patterns in the console:
-
Rapid Street Changes
Current location: Street A [Confidence: 1] Current location: Street B [Confidence: 0] Current location: Street A [Confidence: 0]
This indicates unstable GPS readings. Stay still for better accuracy.
-
Low Confidence Numbers
Current location: Street A [Confidence: 0]
The system isn't sure about your location yet. Wait for confidence to build up.
-
Multiple Cameras
Camera in range: Street A (100m) Camera in range: Street A (150m)
You're in range of multiple cameras. The closest one will be used for alerts.