Crates.io | nominatim-rs |
lib.rs | nominatim-rs |
version | 0.3.0 |
source | src |
created_at | 2021-10-14 06:37:48.581798 |
updated_at | 2023-06-08 18:26:02.04852 |
description | Bindings to the Nominatim web API for rust |
homepage | |
repository | https://gitlab.com/john_t/nominatim-rs |
max_upload_size | |
id | 464811 |
size | 80,021 |
Nominatim-rs is a rust binding for the Nominatim api. It does reverse geolocation (finding a place from coordinates), lookup and search.
Please conform to the Nominatim ToS
This example searches for a location and prints out the JSON
#[tokio::main]
async fn main() {
let client = nominatim_rs::Client::new(
reqwest::Url::parse("https://nominatim.openstreetmap.org/").unwrap(),
"nominatim-rust/0.1.0 test-suite".to_string(),
Some("john_t@mailo.com".to_string()),
)
.unwrap();
let search = client
.search(
nominatim_rs::SearchQueryBuilder::default()
.address_details(true)
.location_query(nominatim_rs::LocationQuery::Generalised {
q: "bakery in berlin wedding".to_string(),
})
.limit(Some(1))
.build()
.unwrap(),
)
.await
.unwrap();
println!("{}", serde_json::to_string_pretty(&search).unwrap());
}