feat(router/speedy): CH router visualization tool — CHQueryExporter + D3.js split-screen HTML#59
Draft
steffenaxer with Copilot wants to merge 13 commits into
Draft
feat(router/speedy): CH router visualization tool — CHQueryExporter + D3.js split-screen HTML#59steffenaxer with Copilot wants to merge 13 commits into
steffenaxer with Copilot wants to merge 13 commits into
Conversation
…alization Agent-Logs-Url: https://github.com/steffenaxer/matsim-libs/sessions/daa1fd17-893b-407f-8bf8-08518d5de0ff Co-authored-by: steffenaxer <26229392+steffenaxer@users.noreply.github.com>
Agent-Logs-Url: https://github.com/steffenaxer/matsim-libs/sessions/daa1fd17-893b-407f-8bf8-08518d5de0ff Co-authored-by: steffenaxer <26229392+steffenaxer@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement CH-Router visualization system for Berlin network
feat(router/speedy): CH router visualization tool — CHQueryExporter + D3.js split-screen HTML
Apr 14, 2026
… for proper WGS84 display The mercatorY() function was returning radians while longitude was in degrees, causing a ~100:1 aspect ratio distortion that squished the Berlin network into a thin horizontal line. Now outputs degree-equivalent units (multiplied by 180/PI), matching the standard Web Mercator convention used by Leaflet and OpenLayers. This makes the projection compatible with future slippy-map tile overlays (OSM, Mapbox, etc.). Agent-Logs-Url: https://github.com/steffenaxer/matsim-libs/sessions/82274a59-eb4c-410f-827e-4a5e09fb5b9b Co-authored-by: steffenaxer <26229392+steffenaxer@users.noreply.github.com>
…, longer routes - Replace custom canvas projection with Leaflet.js tile maps (OSM dark theme) - Synchronized zoom/pan between both map panels - Modern glassmorphism UI with Inter font, refined color palette - Step slider (range input) for seeking forward/backward through events - Forward/backward step buttons with arrow key support - 2.5D mode applies CSS perspective transform to map containers - Longer OD routes in Java exporter (Spandau→Marzahn, Frohnau→Lichtenrade, etc.) - Canvas overlays on top of Leaflet for network/search visualization - devicePixelRatio-aware rendering for HiDPI displays Agent-Logs-Url: https://github.com/steffenaxer/matsim-libs/sessions/38e277ad-1a22-4836-b94e-ea1400fd85ff Co-authored-by: steffenaxer <26229392+steffenaxer@users.noreply.github.com>
… features) Agent-Logs-Url: https://github.com/steffenaxer/matsim-libs/sessions/38e277ad-1a22-4836-b94e-ea1400fd85ff Co-authored-by: steffenaxer <26229392+steffenaxer@users.noreply.github.com>
…erflow:hidden - Replace OSM tiles + broken CSS filter hack with CartoDB Dark Matter (natively dark) - Remove aggressive invert/contrast filter that made map unreadable - Add overflow:hidden to .panel to prevent 2.5D rotation from bleeding across panels Agent-Logs-Url: https://github.com/steffenaxer/matsim-libs/sessions/2209a7e6-3f0c-46e7-ac0a-beaf405e1173 Co-authored-by: steffenaxer <26229392+steffenaxer@users.noreply.github.com>
…et internals The canvas overlays had z-index:2 which is below Leaflet's internal tile pane (z-index ~200) and overlay pane (~400). Raised canvas to z-index:1000, info-box/watermark to 1001. Also properly positioned .leaflet-container with position:absolute;inset:0 within .map-wrap. Agent-Logs-Url: https://github.com/steffenaxer/matsim-libs/sessions/cd8a4f8f-93f0-4295-8084-125aea9324b0 Co-authored-by: steffenaxer <26229392+steffenaxer@users.noreply.github.com>
…ecording - Dropdown: dark background (#1e2233) for select and option elements - Final card: solid opaque background, brighter text (#fff/#cbd5e1), box-shadow - Initial zoom: fit to query route (start/end/path) with pad(0.5) instead of entire network; re-fit when changing OD pair - Video recording: composite map tiles + canvas overlays + labels + final card; enable CORS on tile layer for canvas tile rendering - Added drawMapTilesToCanvas() and drawFinalOverlayToCanvas() helpers Agent-Logs-Url: https://github.com/steffenaxer/matsim-libs/sessions/43f3115c-e0ff-417f-b3d4-c4ea795848ba Co-authored-by: steffenaxer <26229392+steffenaxer@users.noreply.github.com>
…ay; info-boxes in video Java exporter (CHQueryExporter): - Switch to identity graph ordering (SpeedyGraphBuilder.build) - Build SpeedyALTData (16 landmarks) for ALT heuristic - Replace instrumented Dijkstra with instrumented SpeedyALT query (uses ALT estimation, dead-end pruning — matches SpeedyALT.java) - Rename JSON field 'dijkstraEvents' → 'speedyALTEvents' HTML visualization: - Rename all 'Dijkstra' labels → 'SpeedyALT' (title, panels, phase messages, final overlay, video labels) - Support both speedyALTEvents and dijkstraEvents JSON fields (backward compat) - Draw info-box overlay text onto composite canvas during video recording (new drawInfoBoxToCanvas helper with rounded-rect pill background) - Delay final overlay by ~2s after search ends so the route path is visible first (phase 0→1→2 state machine) - Keep recording for 3s after final overlay appears to capture it README: Updated to reflect SpeedyALT comparison Agent-Logs-Url: https://github.com/steffenaxer/matsim-libs/sessions/b1cbd2a4-34d0-4967-9e33-d5d221f864be Co-authored-by: steffenaxer <26229392+steffenaxer@users.noreply.github.com>
… variables Agent-Logs-Url: https://github.com/steffenaxer/matsim-libs/sessions/b1cbd2a4-34d0-4967-9e33-d5d221f864be Co-authored-by: steffenaxer <26229392+steffenaxer@users.noreply.github.com>
…nal overlay, enlarge card - SpeedyALT phase messages now accurately describe ALT heuristic behavior (landmarks, directed search, fewer nodes than Dijkstra) - Final overlay card enlarged from 400x220 to 440x280 and max-width 520px - Route result info (links count, cost) added to HTML and canvas overlays - Java exporter: add routeCost and routeLinks fields to JSON output - CHQueryResult now stores bestCost for export Agent-Logs-Url: https://github.com/steffenaxer/matsim-libs/sessions/facab8bc-3da3-42ec-9057-355df02c7305 Co-authored-by: steffenaxer <26229392+steffenaxer@users.noreply.github.com>
…mment Agent-Logs-Url: https://github.com/steffenaxer/matsim-libs/sessions/facab8bc-3da3-42ec-9057-355df02c7305 Co-authored-by: steffenaxer <26229392+steffenaxer@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Original prompt
Visualisierungskonzept umsetzen
The user has attached the following files from their workspace:
TITLE: CH-Router Visualization for Berlin Network (D3.js + Video Export)
USER INTENT: The user wants to save a detailed implementation plan as a prompt file for building an interactive visualization of the Contraction Hierarchies (CH) router algorithm, intended for a LinkedIn promotional post for iteratively.io.
TASK DESCRIPTION:
Build a two-component visualization system:
CHQueryExporter.java) that runs an instrumented CH query AND Dijkstra query on the Berlin network and exports step-by-step search state as JSONch-visualization.html) with:MediaRecorder+canvas.captureStream(60fps)EXISTING:
matsim/tools/ch-viz/plan-chRouterVisualization.prompt.mdexamples/scenarios/berlin/network.xml.gz(GK4 coordinate system, ~10k nodes)examples/scenarios/berlin/config.xmlmatsim/src/main/java/org/matsim/core/router/speedy/:CHRouter.java— static bidirectional CH query (L152-321 for main loop, L368-394 for edge unpacking)CHRouterTimeDep.java— time-dependent CATCHUp CH query (L178-380 for main loop, L429-448 for edge unpacking)CHGraph.java— CH overlay graph with CSR layout,nodeLevel[],edgeOrigLink[],edgeLower1[],edgeLower2[]CHBuilder.java— contraction hierarchy builder (~2848 lines, parallel ND-based contraction)CHRouterFactory.java— factory with caching, ND ordering, TTF customization pipelineCHTTFCustomizer.java— time-dependent TTF customizationCHCustomizer.java— static weight customizationSpeedyDijkstra.java— reference Dijkstra implementation (L110-178 for main loop)SpeedyGraph.java— optimized graph data structure with spatial node orderingSpeedyGraphBuilder.java— graph builder with Z-order Morton curve reorderingPENDING:
CHQueryExporter.java— New file atmatsim/src/main/java/org/matsim/core/router/speedy/CHQueryExporter.java. Must:NetworkUtils.readNetwork()SpeedyGraphviaSpeedyGraphBuilder.buildWithSpatialOrdering()CHGraphviaCHBuilder.build()+CHTTFCustomizer.customize()CHRouter.calcLeastCostPathImpl()) recording per-PQ-poll events:{step, dir, nodeIdx, cost, parentIdx, stalled, isMeeting}SpeedyDijkstra.calcLeastCostPathImpl()) recording per-PQ-poll events:{step, nodeIdx, cost}edgeLower1/edgeLower2arraysTransformationFactory.getCoordinateTransformation("GK4", "WGS84")),nodeLevel[], and edgesch-query-data.jsonch-visualization.html— New file atmatsim/tools/ch-viz/ch-visualization.html. Must implement:d3.geoMercator()projectionrequestAnimationFramewith speed control#58a6ff, backward=orange#f78166)#d29922)#3fb950)#0d1117background,#1e2937network edges)canvas.captureStream(60)+MediaRecorder(VP9/WebM) → auto-downloadch-router-berlin.webm