Crates.io | openrouteservice |
lib.rs | openrouteservice |
version | 0.2.0 |
created_at | 2025-09-03 09:02:38.133558+00 |
updated_at | 2025-09-05 13:47:49.696982+00 |
description | rust interface to openrouteservice instances |
homepage | |
repository | https://gitlab.com/tsbischof/openrouteservice-rs |
max_upload_size | |
id | 1822199 |
size | 363,312 |
Rust interface to the openrouteservice API
Currently targeting the v2 API.
See examples/
or the crate docs for more details.
$ 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
.
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 ...
Project management is at Gitlab