Module algorithms

Module algorithms 

Source
Expand description

§Algorithm Toolbox

This module provides direct access to all route-matching algorithms. Use these for integrating specific algorithms into your own systems without needing the full engine.

§Core Algorithms

  • Route Matching: AMD-based route comparison
  • Route Grouping: Union-Find clustering of similar routes
  • Section Detection: Find frequently-traveled segments
  • Heatmap Generation: Density visualization

§Geographic Utilities

  • Haversine Distance: Great-circle distance between GPS points
  • Polyline Length: Total distance along a path
  • Bounds Computation: Bounding box for GPS tracks
  • Douglas-Peucker: Line simplification

§Example

use tracematch::algorithms::{
    haversine_distance,
    compare_routes,
    group_signatures,
    GpsPoint, RouteSignature, MatchConfig,
};

// Compute distance between two points
let london = GpsPoint::new(51.5074, -0.1278);
let paris = GpsPoint::new(48.8566, 2.3522);
let distance = haversine_distance(&london, &paris);
println!("London to Paris: {:.0} km", distance / 1000.0);

Re-exports§

pub use crate::Bounds;
pub use crate::GpsPoint;
pub use crate::MatchConfig;
pub use crate::MatchResult;
pub use crate::RouteGroup;
pub use crate::RouteSignature;
pub use crate::geo_utils::bounds_overlap;
pub use crate::geo_utils::compute_bounds;
pub use crate::geo_utils::compute_bounds_tuple;
pub use crate::geo_utils::compute_center;
pub use crate::geo_utils::haversine_distance;
pub use crate::geo_utils::meters_to_degrees;
pub use crate::matching::calculate_route_distance;
pub use crate::compare_routes;
pub use crate::group_signatures;
pub use crate::group_signatures_parallel;
pub use crate::group_incremental;
pub use crate::sections::FrequentSection;
pub use crate::sections::SectionConfig;
pub use crate::sections::SectionPortion;
pub use crate::sections::detect_sections_from_tracks;
pub use crate::heatmap::ActivityHeatmapData;
pub use crate::heatmap::CellQueryResult;
pub use crate::heatmap::HeatmapBounds;
pub use crate::heatmap::HeatmapCell;
pub use crate::heatmap::HeatmapConfig;
pub use crate::heatmap::HeatmapResult;
pub use crate::heatmap::RouteRef;
pub use crate::heatmap::generate_heatmap;
pub use crate::heatmap::query_heatmap_cell;

Structs§

AABB
Axis-aligned bounding box for spatial queries. An n-dimensional axis aligned bounding box (AABB).
RTree
R-tree spatial index for fast geographic queries.

Traits§

RTreeObject
Trait for types that can be spatially indexed.

Functions§

douglas_peucker
Douglas-Peucker line simplification algorithm.
resample_track
Resample a polyline to fixed number of points.