pub fn write_trainpath_geojson(
train_path: &TrainPath,
netelements: &HashMap<String, Netelement>,
writer: &mut impl Write,
) -> Result<(), ProjectionError>Expand description
Write TrainPath as GeoJSON FeatureCollection
Serializes a TrainPath to GeoJSON, with each segment as a separate feature. The overall path probability and metadata are stored in the FeatureCollection properties.
§Arguments
train_path- The TrainPath to serializenetelements- Map of netelement IDs to Netelement geometries (for creating LineString features)writer- Output writer
§Output Format
{
"type": "FeatureCollection",
"properties": {
"overall_probability": 0.89,
"calculated_at": "2025-01-15T10:30:00Z",
"distance_scale": 10.0,
"heading_scale": 2.0
},
"features": [
{
"type": "Feature",
"geometry": { "type": "LineString", "coordinates": [...] },
"properties": {
"netelement_id": "NE_A",
"probability": 0.87,
"start_intrinsic": 0.0,
"end_intrinsic": 1.0,
"gnss_start_index": 0,
"gnss_end_index": 10
}
}
]
}