feat: Enhance track model and import functionality
- Added new fields to TrackModel: status, is_bidirectional, and coordinates. - Updated network service to handle new track attributes and geometry extraction. - Introduced CLI scripts for importing and loading tracks from OpenStreetMap. - Implemented normalization of track elements to ensure valid geometries. - Enhanced tests for track model, network service, and import/load scripts. - Updated frontend to accommodate new track attributes and improve route computation. - Documented OSM ingestion process in architecture and runtime views.
This commit is contained in:
@@ -78,7 +78,31 @@ sequenceDiagram
|
||||
F->>F: Render Leaflet map and snapshot summaries
|
||||
```
|
||||
|
||||
#### 6.2.4 Building Railway Network
|
||||
#### 6.2.4 OSM Track Import and Load
|
||||
|
||||
**Scenario**: Operator refreshes spatial fixtures by harvesting OSM railways and persisting them to PostGIS.
|
||||
|
||||
**Description**: The paired CLI scripts `tracks_import.py` and `tracks_load.py` export candidate track segments from Overpass, associate endpoints with the nearest known stations, and store the resulting LINESTRING geometries. Dry-run flags allow inspection of the generated Overpass payload or database mutations before commit.
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant Ops as Operator
|
||||
participant TI as tracks_import.py
|
||||
participant OL as Overpass API
|
||||
participant TL as tracks_load.py
|
||||
participant DB as PostGIS
|
||||
|
||||
Ops->>TI: Invoke with region + output path
|
||||
TI->>OL: POST compiled Overpass query
|
||||
OL-->>TI: Return rail way elements (JSON)
|
||||
TI-->>Ops: Write normalized tracks JSON
|
||||
Ops->>TL: Invoke with normalized JSON
|
||||
TL->>DB: Fetch stations + existing tracks
|
||||
TL->>DB: Insert snapped LINESTRING geometries
|
||||
TL-->>Ops: Report committed track count
|
||||
```
|
||||
|
||||
#### 6.2.5 Building Railway Network
|
||||
|
||||
**Scenario**: User adds a new track segment to their railway network.
|
||||
|
||||
@@ -101,7 +125,7 @@ sequenceDiagram
|
||||
F->>F: Update map display
|
||||
```
|
||||
|
||||
#### 6.2.5 Running Train Simulation
|
||||
#### 6.2.6 Running Train Simulation
|
||||
|
||||
**Scenario**: User starts a train simulation on their network.
|
||||
|
||||
@@ -129,7 +153,7 @@ sequenceDiagram
|
||||
end
|
||||
```
|
||||
|
||||
#### 6.2.6 Saving Game Progress
|
||||
#### 6.2.7 Saving Game Progress
|
||||
|
||||
**Scenario**: User saves their current game state.
|
||||
|
||||
@@ -154,4 +178,3 @@ sequenceDiagram
|
||||
- **Real-time Updates**: WebSocket connections for simulation updates, with fallback to polling
|
||||
- **Load Balancing**: Backend API can be scaled horizontally for multiple users
|
||||
- **CDN**: Static assets and map tiles served via CDN for faster loading
|
||||
|
||||
|
||||
Reference in New Issue
Block a user