Crates.io | osm_overpass |
lib.rs | osm_overpass |
version | 0.1.2 |
source | src |
created_at | 2024-07-16 10:26:01.382383 |
updated_at | 2024-07-16 15:01:27.997536 |
description | A library to run Overpass queries against OSM Overpass servers. |
homepage | |
repository | |
max_upload_size | |
id | 1304921 |
size | 16,477 |
A library to query OSM Overpass servers
let url = String::from("https://overpass-api.de/api/interpreter");
let query = "
[out:json][timeout:30];
node(3662847634);
// print results
out;
";
let api = api::OverpassAPI::new(url);
let res = api.query(String::from(query)).await;
...
...
let res = api.query_sync(String::from(query));
...
let unwrapped = res.unwrap();
//unwrapped is iterable, so
for nwr in unwrapped {
match nwr {
NWR::Node(n) => ...,
NWR::Way(w) => ...,
NWR::Relation(r) => ...
}
}
Queries must return a JSON result. Put [out:json]
in the first line of
the query to do this.