| Crates.io | valhalla-client |
| lib.rs | valhalla-client |
| version | 0.4.1 |
| created_at | 2023-07-11 01:10:36.518653+00 |
| updated_at | 2025-05-05 21:38:52.129906+00 |
| description | API client for the Valhalla routing engine |
| homepage | |
| repository | https://github.com/jelmer/valhalla-client-rs |
| max_upload_size | |
| id | 913431 |
| size | 281,712 |
This crate contains the types and functions for interacting with the Valhalla API.
These APIs are implemented:
We provide two clients:
valhalla_client::Valhalla andvalhalla_client::blocking::Valhalla using the tokio runtime internally to call the async versionThe second one is behind the (default-enabled) blocking feature, so if you don't need it, you can disable it via default-features = false.
We also offer the (default-enabled) gpx feature.
This enables reading and writing GPX (GPS Exchange Format) files for APIs where we have the needed context.
// an async version is available at valhalla_client::Valhalla
use valhalla_client::blocking::Valhalla;
use valhalla_client::route::{Location, Manifest};
use valhalla_client::costing::{Costing};
let valhalla = Valhalla::default();
let amsterdam = Location::new(4.9041, 52.3676);
let utrecht = Location::new(5.1214, 52.0907);
let manifest = Manifest::builder()
.locations([amsterdam, utrecht])
.costing(Costing::Motorcycle(Default::default()));
let response = valhalla.route(manifest).unwrap();
println!("{:#?}", response);
// If the gpx feature is enabled, you can convert the response to a gpx::Gpx object
// let gpx = response.trip.into();
For further examples, please see the different clients:
valhalla_client::Valhalla andvalhalla_client::blocking::Valhalla