Joey Hershkop

← Back to all projects

Parkking: Turning Toronto Parking Bylaws Into a Live Map

Solo Project • Python (Spatial ETL), SwiftUI (Native iOS), TypeScript (Web GIS)

76,849
Raw Bylaw Rows
21,433
Map Features Emitted
99.2%
Highway Resolve Rate
< 50ms
Tap-to-Verdict Query

The Problem

The City of Toronto publishes parking restrictions as open data, but every single restriction is recorded as descriptive legal prose rather than spatial coordinates:

"A point 59 metres north of Elm Avenue and Spadina Road"

To determine whether you can legally park on a specific curb at 2:30 PM on a Tuesday, you cannot just query a simple boundary box. You need to parse unstructured legal strings, resolve street names and intersections against the city's official Centreline road graph, compute exact physical curb geometries, resolve overlapping multi-bylaw conflicts, and deliver a responsive interface.

What I Built: The 3 Core Pillars

I designed and built an integrated geospatial intelligence suite across data engineering, native mobile, and web:

  • 1. Spatial ETL & NLP Pipeline (parkking-pipeline): An installable Python package using GeoPandas and Shapely that parses freeform legal text into structured temporal schedules, walks Toronto Centreline (TCL) street graphs to resolve intersection nodes, projects spans onto physical road edge polygons, and emits schema-validated GeoJSON with discrete coverage atoms for overlapping bylaws.
  • 2. Offline-First iOS Client (parkking-ios): A native SwiftUI + MapKit mobile application built with zero third-party dependencies. Features an offline curb bylaw engine that evaluates instant parking verdicts with zero network latency, custom time preset scrubbing, and 60/120 fps viewport polyline batching.
  • 3. Responsive Web Client (parkking-web): An interactive, mobile-first web map built with TypeScript and MapLibre GL for instant browser-based parking lookups and reverse geocoding without requiring app installation.
  • Production Testing Discipline: Pytest with golden geometry regression fixtures, Vitest coverage gates, Ruff linting, and cross-language schedule parity tests (Python ↔ TypeScript ↔ Swift) ensuring consistent rule evaluation across all clients.

The Interesting Engineering

1. Legal Prose → Typed Parse Rules

Free-text Between descriptions vary wildly across decades of municipal amendments. I built an ordered pattern-matching engine that classifies text into typed rule definitions (e.g., perfect_offset, block, entire_length). Unmatched strings are recorded in a failure ledger with granular stage and reason codes rather than thrown away, enabling systematic debugging.

2. Local Graph-Walking & Physical Curb Projection

Instead of relying on external geocoding APIs, the pipeline operates locally on Toronto Centreline (TCL) graph data. It identifies intersecting street nodes, calculates metric offsets along LineStrings, and slices segments using Shapely in UTM Zone 17N coordinates.

Through systematic triage of intersection aliases and normalizers, I reduced unresolvable intersection errors from over 6,600 down to 1,174, achieving a 99.2% highway resolve rate on parsed rows.

3. Schema-v2 Coverage Atoms for Overlapping Bylaws

On any given street block, multiple bylaws can overlap (e.g., a "No Parking 7 AM–9 AM" rush-hour rule combined with a "2-Hour Metered Parking 9 AM–6 PM" rule). Rather than rendering overlapping lines that obscure each other, the pipeline sweeps overlapping spans into discrete, non-overlapping coverage atoms with stable identifiers. Each atom carries all contributing legal rules, allowing the client to compute strict verdict precedence without hiding conflicting restrictions.

4. Cross-Language Schedule Parity

Parking rules evaluate complex conditions: Ontario statutory holidays, seasonal months, overnight windows, and midnight truncation. The schedule engine is implemented across Python (pipeline), TypeScript (web), and Swift (iOS), validated against a shared test fixture corpus to ensure zero behavioral drift.

Methodology Note: Pipeline metrics measure parse throughput and geometric graph resolution. Golden regression tests guard against sample regressions; full ground-truth surveyed curb validation remains an ongoing exploration.

Key Takeaways

Parkking demonstrated the value of treating side projects with production-grade engineering: structured failure ledgers, golden test suites, cross-language contracts, and resilient data modeling. The hardest part wasn't drawing lines on a map—it was creating a deterministic, verifiable system out of ambiguous municipal legal prose.