Heat map of most recent aggregated bus lane violations (up to 1000), within the last month grouped by lat, lng from automated bus-mounted cameras
SELECT
ROUND(violation_latitude, ${accuracy}) AS lat,
ROUND(violation_longitude, ${accuracy}) AS lng,
count(*) AS violation_count
WHERE
first_occurrence >= '${thirtyDaysAgo}'
${includeExempt ? '' : `AND NOT starts_with(violation_status, "EXEMPT")`}
GROUP BY
ROUND(violation_latitude, ${accuracy}),
ROUND(violation_longitude, ${accuracy})