Getting Started
Build your first road-network-backed travel-time matrix with solverforge-maps.
solverforge-maps is SolverForge’s Rust library for map-backed routing workflows. It is designed for vehicle routing and similar optimization problems where you need to turn geographic coordinates into travel times, route geometries, and network diagnostics.
Coord and BoundingBox[dependencies]
solverforge-maps = "2"
tokio = { version = "1", features = ["full"] }
use solverforge_maps::{BoundingBox, Coord, NetworkConfig, RoadNetwork, RoutingResult};
#[tokio::main]
async fn main() -> RoutingResult<()> {
let locations = vec![
Coord::try_new(39.95, -75.16)?,
Coord::try_new(39.96, -75.17)?,
Coord::try_new(39.94, -75.15)?,
];
let bbox = BoundingBox::from_coords(&locations).expand_for_routing(&locations);
let config = NetworkConfig::default();
let network = RoadNetwork::load_or_fetch(&bbox, &config, None).await?;
let matrix = network.compute_matrix(&locations, None).await;
let route = network.route(locations[0], locations[1])?;
println!("{} locations", matrix.size());
println!("Route duration: {} seconds", route.duration_seconds);
Ok(())
}
route() snaps endpoints to nearby graph nodes. For frontend geometry that should stay anchored to the containing road segments, use snap_to_edge with route_edge_snapped instead.
Use solverforge-maps when your optimization model needs real road travel times instead of crow-flies distance. Typical use cases include:
Coord, BoundingBox, NetworkConfig, and RoadNetworkBuild your first road-network-backed travel-time matrix with solverforge-maps.
Compute routes, choose objectives, and build matrix data for optimization.
Cache inspection, progress reporting, and production-oriented diagnostics.
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.