#openstreetmap #maps #gis

bin+lib overpass

Query OpenStreetMap Nodes

1 unstable release

0.1.0 Mar 28, 2024

#304 in Geospatial

MIT license

14KB
169 lines

overpass-rs

Query OpenStreetMap nodes by attribute

Use with absolute caution. Querying OSM can hog down an Overpass server easily. I am not responsible for any damage this tool may cause.

Usage

This tool is available on crates.io and can be installed via cargo install overpass. It features a helpful CLI you can access via -h / --help.

It is also available as a library.

CLI Example

overpass\
  --url=https://overpass-api.de/api/interpreter \
  --key=amenity \
  --val=cafe bbox \
  --xmin=51.305219521963295 \
  --ymin=-0.7690429687500001 \
  --xmax=51.82219818336938 \
  --ymax=0.5273437500000064

Library Example

use overpass::{BoundingBox, Config};
use tokio;

#[tokio::main]
async fn main() {
 let c: Config = Config {
     url: "https://overpass-api.de/api/interpreter",
     timeout: 25,
     key: "amenity",
     val: "cafe",
 };

 let b: BoundingBox = BoundingBox {
     x_min: 51.305219521963295,
     y_min: -0.7690429687500001,
     x_max: 51.82219818336938,
     y_max: 0.5273437500000064,
 };

 let resp = b.search(&c).await.expect("failed query");

Dependencies

~7–18MB
~241K SLoC