Skip to content

Algorithms

Core algorithms used across the syncc platform, organized by category.


Geospatial

Page Summary
Haversine Distance Great-circle distance between two lat/lng pairs in meters
Google Encoded Polyline Encode/decode route geometries using Google's 5-decimal polyline format
Valhalla Polyline Decoder Decode Valhalla routing responses (6-decimal precision)
Snap to Polyline Find the closest point on a polyline to a clicked location (admin map editing)
Geodesic Line-Segment Projection Snapping Perpendicular projection onto route segments to close transit-to-walk gaps
Walking Path Snapping Trim OSRM walking legs where they diverge from the bus route
Along-Route Distance Accumulation Sum polyline segments between two indices for true road distance
Checkpoint Proximity Detection Detect when a vehicle arrives within radius of a route checkpoint

Routing Integration

Page Summary
OSRM Multi-Segment Path Building Chain OSRM segments through ordered waypoints into a single polyline
GTFS Shape Matching & Polyline Clipping Select best GTFS direction and clip route shape to the board→alight segment

Search & Matching

Page Summary
Route Direction Matching Find valid boarding → alighting stop pairs for a passenger journey
GTFS Stop Search Fuzzy/accent-tolerant stop autocomplete, nearest-N, and within-radius queries
Active Trip Suggestions Real-time direct and transfer trip recommendations for passengers

Data Processing

Page Summary
GTFS Index Building Parse GTFS CSVs and La Paz GeoJSON into memory-resident lookup indexes
Schedule Day-of-Week Bitmask Match recurring schedules to today using bitwise day flags

Estimation

Page Summary
ETA Estimation Estimate bus and walking arrival times from distance and speed constants