Crates.io | ogcapi-client |
lib.rs | ogcapi-client |
version | 0.2.0 |
source | src |
created_at | 2022-07-21 22:25:22.465483 |
updated_at | 2024-05-19 11:58:05.372888 |
description | Client to access OGC API Feature and STAC endpoints. |
homepage | |
repository | https://github.com/georust/ogcapi |
max_upload_size | |
id | 629891 |
size | 20,090 |
The ogcapi-client
crate provides a client for accessing geospatial datasets served through OGC API or SpatioTemporal Asset Catalog (STAC) with the following features:
use ogcapi_client::Client;
use ogcapi_types::common::Bbox;
use ogcapi_types::stac::SearchParams;
fn main() {
// Setup a client for a given STAC endpoint
let endpoint = "https://data.geo.admin.ch/api/stac/v0.9/";
let client = Client::new(endpoint).unwrap();
// Fetch root catalog and print `id`
let root = client.root().unwrap();
println!("Root catalog id: {}", root.id);
// Count catalogs
let catalogs = client.catalogs().unwrap();
println!("Found {} catalogs!", catalogs.count());
// Search items
let bbox = Bbox::from([7.4473, 46.9479, 7.4475, 46.9481]);
let params = SearchParams::new()
.with_bbox(bbox)
.with_collections(["ch.swisstopo.swissalti3d"].as_slice());
let items = client.search(params).unwrap();
println!("Found {} items!", items.count());
}