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,
pub intrinsic: Option<f64>,
}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_lib_core::{parse_gnss_csv, parse_network_geojson, RailwayNetwork};
use tp_lib_core::{project_gnss, ProjectionConfig};
// Load and project data
let (netelements, _netrelations) = 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
intrinsic: Option<f64>Intrinsic coordinate (0-1 range) relative to netelement start Only populated when projecting onto a calculated train path (US2)
Implementations§
Source§impl ProjectedPosition
impl ProjectedPosition
Sourcepub fn new(
original: GnssPosition,
projected_coords: Point<f64>,
netelement_id: String,
measure_meters: f64,
projection_distance_meters: f64,
crs: String,
) -> Self
pub fn new( original: GnssPosition, projected_coords: Point<f64>, netelement_id: String, measure_meters: f64, projection_distance_meters: f64, crs: String, ) -> Self
Create a new projected position
Sourcepub fn with_intrinsic(
original: GnssPosition,
projected_coords: Point<f64>,
netelement_id: String,
measure_meters: f64,
projection_distance_meters: f64,
crs: String,
intrinsic: f64,
) -> Self
pub fn with_intrinsic( original: GnssPosition, projected_coords: Point<f64>, netelement_id: String, measure_meters: f64, projection_distance_meters: f64, crs: String, intrinsic: f64, ) -> Self
Create a new projected position with intrinsic coordinate (for path projection)
Trait Implementations§
Source§impl Clone for ProjectedPosition
impl Clone for ProjectedPosition
Source§fn clone(&self) -> ProjectedPosition
fn clone(&self) -> ProjectedPosition
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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>,
Auto Trait Implementations§
impl Freeze for ProjectedPosition
impl RefUnwindSafe for ProjectedPosition
impl Send for ProjectedPosition
impl Sync for ProjectedPosition
impl Unpin for ProjectedPosition
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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