Skip to content

Rail curve radius analysis and max speed evaluation#1793

Draft
tahini wants to merge 4 commits intomainfrom
railCurveRadius
Draft

Rail curve radius analysis and max speed evaluation#1793
tahini wants to merge 4 commits intomainfrom
railCurveRadius

Conversation

@tahini
Copy link
Collaborator

@tahini tahini commented Feb 17, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Added curve-aware travel time and speed analysis for rail transit paths with interactive visualization
    • New curve segments and deflection point layers display on the map for visual path analysis
    • Interactive speed profile charts show travel time, speed limits, and radius constraints
    • New statistics panel displays per-segment curve metrics and breakdown
  • UI & UX

    • Enhanced path statistics with curve-related calculations and metrics
    • Added toggle control to show/hide curve analysis visualization layers
    • Improved map responsiveness with optimized event handling

Screenshots:

image image image image image image image

@tahini
Copy link
Collaborator Author

tahini commented Feb 17, 2026

This is the feature branch to be used on some of our instances

Copy link
Collaborator Author

@tahini tahini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'ai testé rapidement localement: pourquoi ça ne fonctionne pas avec le métro?

"TotalTripTime": "Temps total du trajet",
"TravelTime": "Temps de parcours",
"GeometryResolutionWarningNone": "La forme du parcours utilise seulement des lignes droites entre les stations. Les courbes sont ignorées dans le calcul; les temps de parcours utilisent un calcul cinématique simple (accélération/vitesse de croisière/décélération).",
"GeometryResolutionWarningLow": "La forme du parcours a une résolution faible (changements de direction abrupts détectés). Les courbes sont ignorées dans le calcul; les temps de parcours utilisent un calcul cinématique simple. Les sommets avec une précision insuffisante sont surlignés par des cercles orange sur la carte. Ajoutez ou ajustez les points de passage à ces endroits pour lisser le parcours et activer l'analyse des courbes.",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Les courbes sont ignorées dans le calcul" qu'est-ce que ça implique? Pendant cette distance, est-ce que ça roule à pleine vitesse? Ou à une vitesse minimale?. "calcul cinématique simple", dans le cas des courbes trop abruptes? c'est quoi le calcul?

Ce serait bien d'avoir l'option lissage.

Reduce comments lines length for easier reading.
Rail modes are now a subset of transit modes and a function is provided to check if a mode is a rail mode.
Closes #128

Implement curve radius analysis for rail transit paths
(tram, metro, rail, monorail, etc.) that estimates speed limits imposed
by track curvature and adjusts travel times accordingly
when geometry is precise enough.

transition-backend:
- Add railCurves/ module with geometry analysis
  (radius estimation via inscribed circle method),
  curvature segmentation, speed profile generation (forward-backward pass
  with acceleration/deceleration), and segment travel time calculation
- Add transitPaths.curveAnalysis socket API endpoint for on-demand
  curve analysis from the frontend
- Add transitPathCurves.socketRoutes.test.ts with 14 tests covering
  edge cases, multi-segment paths, all rail modes, large angle detection,
  dwell time impact, and speed impact
- Register new socket route in all.socketRoutes.ts

transition-common:
- Add railCurves/types.ts to transition-common (shared types)
- Add geometry resolution detection (high/low/none/almostStraight) to
  skip curve analysis when path shapes are too coarse

transition-frontend:
- Add CurveStatsPanel with interactive speed profile chart (Recharts)
  supporting time and distance X-axis modes, proportional chart width,
  and configurable tick intervals
- Add CurveStatsTable for per-segment travel time breakdown
- Add map layers for curve segments (orange) and large-angle vertices
  (orange circles) to help users identify imprecise path geometry
- Update TransitPathEdit to fetch curve analysis from backend API,
  auto-refresh on geometry changes (waypoint drag, node add/remove,
  undo/redo), and show progress notification during calculation
- Apply curve-aware travel times to path data (operatingTime, speeds)
  so schedules and saved paths use curve-adjusted values
- Add pathStale warning when parameters or geometry change, cleared
  after route recalculation
- Update TransitPathStatistics to show curve-aware travel times for
  rail modes, hiding curve comparison when geometry is not high-res
- Add styles for curve stats panel, table, chart, and toggle controls

Locales:
- Add English and French translations for all new curve analysis UI
  strings, warnings, labels, and progress notifications

New package:
- recharts for curve stats panel chart
@coderabbitai
Copy link

coderabbitai bot commented Feb 24, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch railCurveRadius

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Implement a backend service that applies Chaikin's corner-cutting
algorithm to smooth path geometry between transit nodes. Each
node-to-node segment is smoothed independently while preserving
node positions. A convergence check (same deflection angle + spacing
criteria as the curve analysis geometry resolution detector) prevents
adding waypoints to segments that are already smooth, so repeated
clicks do not cause unbounded point growth.

Backend:
- New chaikinSmoothing.ts service with hasCoarseVertices(),
  chaikinSmoothSegment(), and chaikinSmoothPath()
- New transitPaths.smoothPath socket route (separate from curve analysis)
- 30 unit tests covering the algorithm and socket route

Frontend:
- Add a smooth button (bezier curve icon) in the path edit form,
  visible only when the routing engine is 'manual' (click on map)
- The button sets smoothed coordinates as waypoints then calls
  updateGeography() to recalculate distances, travel times and stats
- Add travel time and speed rows that compare with/without curve
  limits when curve analysis is available (both including and
  excluding dwell times)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants