pub struct ProjectedPosition {
pub original: GnssPosition,
pub projected_coords: Point<f64>,
pub netelement_id: String,
pub measure_meters: f64,
pub projection_distance_meters: f64,
pub crs: String,
}Expand description
Represents a GNSS position projected onto a railway netelement
A ProjectedPosition is the result of projecting a GNSS measurement onto the
nearest railway track segment. It preserves the original GNSS data and adds:
- Projected coordinates on the track centerline
- Measure (distance along track from netelement start)
- Projection distance (perpendicular distance from original to projected point)
- Netelement assignment
§Use Cases
- Calculate train progress along tracks
- Analyze position accuracy and quality
- Detect track deviations or sensor errors
- Generate linear referencing for asset management
§Examples
use tp_core::{parse_gnss_csv, parse_network_geojson, RailwayNetwork};
use tp_core::{project_gnss, ProjectionConfig};
// Load and project data
let netelements = parse_network_geojson("network.geojson")?;
let network = RailwayNetwork::new(netelements)?;
let positions = parse_gnss_csv("gnss.csv", "EPSG:4326", "latitude", "longitude", "timestamp")?;
let config = ProjectionConfig::default();
let projected = project_gnss(&positions, &network, &config)?;
// Analyze results
for pos in projected {
println!("Track position: {}m on {}", pos.measure_meters, pos.netelement_id);
println!("Projection accuracy: {:.2}m", pos.projection_distance_meters);
}Fields§
§original: GnssPositionOriginal GNSS measurement (preserved)
projected_coords: Point<f64>Projected coordinates on the track axis
netelement_id: StringID of the netelement this position was projected onto
measure_meters: f64Distance along the netelement from start (in meters)
projection_distance_meters: f64Distance between original GNSS position and projected position (in meters)
crs: StringCoordinate Reference System of the projected coordinates
Implementations§
Trait Implementations§
Source§impl Clone for ProjectedPosition
impl Clone for ProjectedPosition
Source§fn clone(&self) -> ProjectedPosition
fn clone(&self) -> ProjectedPosition
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ProjectedPosition
impl Debug for ProjectedPosition
Source§impl<'de> Deserialize<'de> for ProjectedPosition
impl<'de> Deserialize<'de> for ProjectedPosition
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ProjectedPosition
impl RefUnwindSafe for ProjectedPosition
impl Send for ProjectedPosition
impl Sync for ProjectedPosition
impl Unpin for ProjectedPosition
impl UnwindSafe for ProjectedPosition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more