openrouteservice

Crates.ioopenrouteservice
lib.rsopenrouteservice
version0.2.0
created_at2025-09-03 09:02:38.133558+00
updated_at2025-09-05 13:47:49.696982+00
descriptionrust interface to openrouteservice instances
homepage
repositoryhttps://gitlab.com/tsbischof/openrouteservice-rs
max_upload_size
id1822199
size363,312
Thomas Bischof (tsbischof)

documentation

https://docs.rs/openrouteservice

README

openrouteservice

Documentation

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

MIT License

Contribution

Project management is at Gitlab

Commit count: 17

cargo fmt