3 releases (breaking)
Uses new Rust 2024
| new 0.3.0 | Dec 2, 2025 |
|---|---|
| 0.2.0 | Sep 5, 2025 |
| 0.1.0 | Sep 3, 2025 |
#119 in Geospatial
105KB
2.5K
SLoC
openrouteservice
Rust interface to the openrouteservice API
Currently targeting the v2 API.
Quickstart
See examples/ or the crate docs for more details.
Library use
$ cargo add openrouteservice --features async,isochrones
use openrouteservice::{
Client, ClientConfigBuilder, Coord,
Profile, isochrones::RequestBuilder,
};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let api_key = "0xdeadbeef"; // replace with your key
let cfg = ClientConfigBuilder::default()
.api_key(Some(api_key))
.build()?;
let ors = Client::new(cfg)?;
let req = RequestBuilder::default()
.profile(Profile::DrivingCar)
.locations(vec![(11.57, 48.13).into()])
.range(vec![200])
.build()?;
let resp = ors.execute(&req).await?;
println!("{}", resp.to_string());
Ok(())
}
Or sync, if you want.
Same general interface, just use --features blocking and the blocking::Client.
Command-line interface
Use API_KEY and BASE_URL as environment variables or pass them directly.
$ cargo build --features cli
Test your local instance:
$ ors --base-url http://localhost:8080/ors/ health
{"status":"ready"}
$ ors --base-url http://localhost:8080/ors/ status
... large json response ...
Run queries on the public instance:
$ ors --api-key ORS_KEY \
isochrones \
--profile driving-car \
--locations 11.6,48 \
--range 100
... geojson response ...
$ API_KEY=ORS_KEY ors \ # env variables!
isochrones \
--profile driving-car \
--locations 11.6,48 \
--range 100
... geojson response ...
$ ors --base-url http://localhost:8080/ors/ \
isochrones \
--profile driving-car \
--locations [[11.6,48.0]] \
--range 100
... geojson response ...
License
Contribution
Project management is at Gitlab
Dependencies
~5–21MB
~247K SLoC