Crate overpass

Source
Expand description

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};

#[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");

Structs§

BoundingBox
Defines a bounding box by its coordinate boundaries (in radians)
Config
Query configuration
Node
Defines an OSM node
OSMMetaData
Metadata returned by the Overpass API
OverpassResponse
Node data returned by the Overpass API