route-data-flow
"/home/yossef/notes/git/projects/inguide/flows/route-data-flow.md"
path: inguide/flows/route-data-flow.md
- **fileName**: route-data-flow
- **Created on**: 2026-06-16 00:48:42
route-data-flow
cs# route-data-flow
Purpose: Complete data path from user tapping a route on the map to AR waypoint rendering.
Chain
1. User places pins / searches room on map
→ maplibra_web/src/pathfinding/route-compute.js
→ Portal engine or legacy A* computes path through graph
2. Route rendered, bridge notified
→ maplibra_web/src/path-renderer/route.js:33
→ window.AndroidBridge.onRouteComputed(JSON.stringify(route))
3. Native MapBridge receives route JSON
→ app/.../ui/map/MapScreen.kt:832 (onRouteComputed)
→ routeData.value = payload (string)
4. MainScreen parses into ArRouteData
→ app/.../ui/main/MainScreen.kt:146-151 (derivedStateOf)
→ parseRouteJson() extracts waypoints + connectors
→ Computes totalDistance via Haversine, ~1.4m/s walk duration
5. AR screen receives parsed route
→ app/.../ui/main/MainScreen.kt:337-345
→ ArNavigationScreen(initialRouteData = parsedArRouteData)
6. ViewModel processes route
→ app/.../ar/ArNavigationViewModel.kt:20-26 (setRoute)
→ State → Navigating(route) if waypoints non-empty
7. Camera + waypoints rendered
→ CameraX Preview bound to PreviewView
→ CoordinateRegistration.toArPosition() → [east, north, floorHeight]
→ ArWaypointRenderer → up to 4 rendered waypoints
→ Canvas draws circles + connecting lines on camera feed
Data Formats
Web → Android (bridge JSON)
{
"lineFeatures": [{ "type":"Feature", "geometry":{ "type":"LineString", "coordinates":[[lng,lat],...] }, "properties":{"floorId":"...","kind":"route-line"} }],
"connectorFeatures": [{ "type":"Feature", "geometry":{ "type":"Point", "coordinates":[lng,lat] }, "properties":{"floorId":"...","connectorLabel":"Stairs up","connectionType":"stairs"} }]
}
Android → AR (ArRouteData)
ArRouteData(
waypoints = [ArWaypoint(lng, lat, floorId, label?, isTransition, connectionType?)],
totalDistance = <haversine-sum>,
estimatedDuration = <distance/1.4>,
startFloorId = waypoints[0].floorId
)
Related: ./ar-navigation-flow.md, ../modules/webview.md, ../modules/pathfinding.md, ../modules/ar.md
continue:[[]]
before:[[]]