georust / ogcapi Goto Github PK
View Code? Open in Web Editor NEWOGC API building blocks implemented in Rust
License: Apache License 2.0
OGC API building blocks implemented in Rust
License: Apache License 2.0
The work being done here is very interesting and may reach a wider audience by being listed on the georust.org website. I think all you need to do is submit a pull request here.
This may be EBKAC (I'm still learning the new cargo
dependency feature propagation syntax), but I'm struggling to enable the stac
feature when using the top-level ogcapi
crate, and wondered if you might have advice.
Cargo.toml
:
[package]
name = "ogcapi-client-test"
version = "0.1.0"
edition = "2021"
[dependencies]
ogcapi = { git = "https://github.com/georust/ogcapi.git", features = ["client", "stac"] }
src/main.rs
:
use ogcapi::client::Client;
use ogcapi::types::common::Bbox;
use ogcapi::types::stac::SearchParams;
fn main() {
let endpoint = "https://data.geo.admin.ch/api/stac/v0.9/";
let client = Client::new(endpoint).unwrap();
let root = client.root().unwrap();
println!("Root catalog id: {}", root.id);
let catalogs = client.catalogs().unwrap();
println!("Found {} catalogs!", catalogs.count());
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());
}
Output:
❯ cargo build
Compiling ogcapi-client-test v0.1.0 (/Users/sfitch/Coding/tmp/ogcapi-client-test)
error[E0599]: no method named `catalogs` found for struct `Client` in the current scope
--> src/main.rs:10:27
|
10 | let catalogs = client.catalogs().unwrap();
| ^^^^^^^^ method not found in `Client`
error[E0599]: no method named `search` found for struct `Client` in the current scope
--> src/main.rs:16:24
|
16 | let items = client.search(params).unwrap();
| ^^^^^^ method not found in `Client`
For more information about this error, try `rustc --explain E0599`.
error: could not compile `ogcapi-client-test` due to 2 previous errors
Running
cargo test --lib client::tests::collections -- --nocapture --exact
Results in the test looping over the same request, calling this URL over and over again:
https://data.geo.admin.ch/api/stac/v0.9/collections?cursor=cD1JbnRlcnZlbnRpb24rcmVnaW9ucytmb3IrZW1lcmdlbmN5K2NhbGwrbnVtYmVyKzE0Mytvbittb2JpbGUrbmV0d29yaw%3D%3D
After adding some additional debugging output (including printing the collection id) the following error is extracted
error decoding response body: data did not match any variant of untagged enum Bbox at line 1 column 87085'
... Fetching https://data.geo.admin.ch/api/stac/v0.9/ Fetching https://data.geo.admin.ch/api/stac/v0.9/collections ch.bfe.energiestaedte-2000watt-areale ch.bakom.mobilnetz-2g ch.swisstopo.swissbuildings3d_3_0 ch.bakom.mobilnetz-3g ch.bakom.mobilnetz-4g ch.bakom.mobilnetz-5g ch.are.erreichbarkeit-oev ch.are.erreichbarkeit-miv ch.bazl.luftfahrtkarten-icao ch.are.alpenkonvention ch.blw.alpprodukte ch.bafu.wald-vegetationshoehenstufen_2085_weniger_trocken ch.bafu.wald-tannenareale ch.bafu.waldschadenflaechen-vivian ch.bakom.anschlussart-koaxialkabel ch.bakom.anschlussart-kupferdraht ch.bakom.anschlussart-glasfaser ch.astra.nationalstrassenachsen ch.bafu.gewaesserschutz-badewasserqualitaet ch.bfe.biogasanlagen ch.blw.landwirtschaftliche-zonengrenzen ch.bfs.volkszaehlung-gebaeudestatistik_gebaeude ch.bfs.volkszaehlung-gebaeudestatistik_wohnungen ch.bfs.betriebszaehlungen-beschaeftigte_vollzeitaequivalente ch.bfs.betriebszaehlungen-arbeitsstaetten ch.bav.seilbahnen-bundeskonzession ch.are.agglomerationsverkehr ch.meteoschweiz.klimaszenarien-raumklima ch.blw.klimaeignung-getreidebau ch.blw.klimaeignung-kulturland ch.blw.klimaeignung-futterbau ch.blw.klimaeignung-koernermais ch.blw.klimaeignung-typ ch.blw.klimaeignung-kartoffeln ch.blw.niederschlagshaushalt ch.blw.klimaeignung-spezialkulturen ch.blw.klimaeignung-zwischenfruchtbau ch.bfe.abgeltung-wasserkraftnutzung ch.baspo.nationales-sportanlagenkonzept ch.astra.ivs-nat-verlaeufe ch.bfe.energieforschung ch.bfe.stauanlagen-bundesaufsicht ch.bafu.gewaesserschutz-klaeranlagen ch.blw.bewaesserungsbeduerftigkeit ch.bafu.wald-obere_waldgrenze ch.bafu.gewaesserschutz-diffuse_eintraege_stickstoff ch.bafu.gewaesserschutz-diffuse_eintraege_phosphor ch.blw.bodeneignung-kulturtyp ch.blw.bodeneignung-kulturland ch.blw.bodeneignung-naehrstoffspeichervermoegen ch.blw.bodeneignung-wasserdurchlaessigkeit ch.blw.bodeneignung-gruendigkeit ch.blw.bodeneignung-skelettgehalt ch.blw.bodeneignung-vernaessung ch.blw.bodeneignung-wasserspeichervermoegen ch.bafu.oekomorphologie-f ch.bafu.landesforstinventar-wirtschaftsregionen ch.bfe.elektrizitaetsproduktionsanlagen ch.bfe.sachplan-uebertragungsleitungen_kraft ch.bakom.notruf ch.bfe.energiestaedte ch.blw.erosion ch.blw.erosion-quantitativ ch.bav.anlagen-schienengueterverkehr ch.astra.ivs-nat_abgrenzungen ch.astra.ivs-nat_wegbegleiter ch.astra.ivs-nat ch.astra.ivs-gelaendekarte ch.blw.feldblockkarte ch.blw.erosion-fliesswegkarte ch.bafu.wald-standortsregionen ch.bafu.wald-foehnhaeufigkeit_jahr ch.bfs.generalisierte-grenzen_agglomerationen_g1 ch.bfs.generalisierte-grenzen_agglomerationen_g2 ch.swisstopo.geoidmodell-etrs89 ch.swisstopo.geoidmodell-ch1903 ch.bazl.segelflugkarte ch.bfe.erneuerbarheizen-mehrfamilienhaeuser ch.bfe.erneuerbarheizen ch.blw.hang_steillagen ch.are.wohnungsinventar-zweitwohnungsanteil ch.bakom.downlink1000 ch.bakom.downlink100 ch.bakom.downlink10 ch.bakom.downlink300 ch.bakom.downlink30 ch.bakom.downlink500 ch.bakom.uplink1000 ch.bakom.uplink100 ch.bakom.uplink10 ch.bakom.uplink1 ch.bakom.notruf-112_festnetz ch.bakom.notruf-112_mobilnetz ch.bakom.notruf-112_satellit ch.bakom.notruf-117_festnetz ch.bakom.notruf-117_mobilnetz ch.bakom.notruf-118_festnetz ch.bakom.notruf-118_mobilnetz ch.bakom.notruf-143_festnetz ch.bakom.notruf-143_mobilnetz Fetching https://data.geo.admin.ch/api/stac/v0.9/collections?cursor=cD1JbnRlcnZlbnRpb24rcmVnaW9ucytmb3IrZW1lcmdlbmN5K2NhbGwrbnVtYmVyKzE0Mytvbittb2JpbGUrbmV0d29yaw%3D%3D thread 'client::tests::collections' panicked at 'Error reading collection: Encountered a request error: error decoding response body: data did not match any variant of untagged enum Bbox at line 1 column 87085', ogcapi-client/src/client.rs:470:21
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.