overpass-lib
Easily create and execute Overpass API queries of OpenStreetMap. Supports both declarative and builder syntax for generating OverpassQL strings, a [reqwest]-based submission API, and type definitions for handling the query results.
Usage
Just like in OverpassQL, you specify a [Set] of [Element]s that you want, defined either as a basic [FilterSet] or as compositions of other sets (e.g. [UnionSet]). You can either define these structs directly, or use [SetBuilder] for more convenient syntax.
Once your set is specified, you:
- Convert it to a [Query] or [QueryBuilder],
- Apply any top-level settings to the query (e.g. [Query::search_bbox]),
- Evaluate the query via an Overpass API server ([OverpassServer]),
- Do whatever you like with the [Element]s returned!
Examples
// Let's find all the landmarks in downtown Seattle in a standard OverpassQL string.
let oql = .join;
// Using the declarative syntax, it looks like this:
let dec_query = Query ;
assert_eq!;
// Using the builder API it looks like this:
let builder_query: Query = all_nodes_or_ways
.with_tag_value
.to_query
.search_bbox
.into;
assert_eq!;
// Evaluate the query via the default Overpass API server
let res = default.evaluate.await.unwrap;
// One of those landmarks should be the Space Needle.
assert!;
Language Support
- Settings
- ✅ timeout
- ✅ maxsize
- ✅ bbox
- ✅ date
- ✅ diff
- ❌ adiff
- ❌ out count
- ✅ out verbosity
- ❌ out modificators
- ❌ out bbox
- ❌ out sort order
- ❌ out limit
- Sets
- ✅ union
- ❌ difference
- ✅ intersection
- ❌ if-block
- ❌ foreach
- ❌ for
- ❌ complete
- ❌ retro
- ❌ compare
- ❌ recurse up
- ❌ recurse up relations
- ❌ recurse down
- ❌ recurse down relations
- ❌ is_in
- ❌ timeline
- ❌ local
- ❌ convert
- ❌ make
- Filters
- ✅ has-kv
- ✅ bbox
- ✅ recurse refs
- ❌ recurse way cnt/link
- ✅ input set
- ✅ id
- ❌ around
- ❌ poly
- ❌ newer
- ❌ changed
- ❌ user
- ❌ area
- ❌ pivot
- ❌ if
- ❌ evaluators
Contributing
Issues and pull requests welcome through GitHub.
License: MIT