|
2 | 2 |
|
3 | 3 | === Search the Global Discovery Catalogue
|
4 | 4 |
|
5 |
| -The https://wmo-im.github.io/wis2-guide/guide/wis2-guide-DRAFT.html#_2_4_4_global_discovery_catalogue[Global Discovery Catalogue (GDC)] allows for a wide range of query predicates to search for data in WIS2 as per the OGC API - Records - Part 1: Core specification. |
| 5 | +The https://wmo-im.github.io/wis2-guide/guide/wis2-guide-APPROVED.html#_2_4_4_global_discovery_catalogue[Global Discovery Catalogue (GDC)] allows for a wide range of query predicates to search for data in WIS2 as per the OGC API - Records - Part 1: Core specification. |
6 | 6 |
|
7 | 7 | The GDC can be searched via the `/collections/wis2-discovery-metadata/items` endpoint. This endpoint provides a number query parameters as described in the examples below.
|
8 | 8 |
|
@@ -50,3 +50,48 @@ Note that the format of `bbox` is comma-separated values in the following order:
|
50 | 50 | - present search results 1-10: `limit=10`
|
51 | 51 | - present search results 11-20: `limit=10&offset=10`
|
52 | 52 | - limit to 3 search results: `limit=3`
|
| 53 | + |
| 54 | +=== Finding data subscription services from the Global Discovery Catalogue |
| 55 | + |
| 56 | +The https://wmo-im.github.io/wis2-guide/guide/wis2-guide-DRAFT.html#_2_4_4_global_discovery_catalogue[Global Discovery Catalogue (GDC)] contains both real-time and non real-time data. The https://wmo-im.github.io/wcmp2/standard/wcmp2-STABLE.html[WMO Core Metadata Profile (WCMP2)] allows for description of real-time data via its https://wmo-im.github.io/wcmp2/standard/wcmp2-STABLE.html#_1_19_links_and_distribution_information[distribution information], which data publishers use to describe and define connectivity and subscription information for a given dataset. |
| 57 | + |
| 58 | +A typical WCMP2 distribution link for data subscriptions can be found below: |
| 59 | + |
| 60 | +[source,json] |
| 61 | +---- |
| 62 | +{ |
| 63 | + "rel": "items", |
| 64 | + "href": "mqtts://everyone:everyone@globalbroker.meteo.fr:8883", |
| 65 | + "channel": "origin/a/wis2/ca-eccc-msc/data/core/hydrology", |
| 66 | + "type": "application/geo+json", |
| 67 | + "title": "Data notifications" |
| 68 | +} |
| 69 | +---- |
| 70 | + |
| 71 | +[NOTE] |
| 72 | +==== |
| 73 | +The `channel` property represents WIS2 topic which can be used to subscribe to the `href` property (i.e. the MQTT address) of the Global Broker (GB). |
| 74 | +==== |
| 75 | + |
| 76 | +Programatically, a GDC client can query the catalogue and filter the results for real-time subscriptions in the following manner: |
| 77 | + |
| 78 | +[source,python] |
| 79 | +---- |
| 80 | +import requests |
| 81 | +
|
| 82 | +response = requests.get('https://wis2-gdc.weather.gc.ca/collections/wis2-discovery-metadata/items').json() |
| 83 | +
|
| 84 | +
|
| 85 | +def is_wis2_subscription_link(link) -> bool: |
| 86 | + if (link['href'].startswith('mqtt') and |
| 87 | + link.get('channel', '').startswith(('origin/a/wis2', 'cache/a/wis2'))): |
| 88 | + return True |
| 89 | +
|
| 90 | +
|
| 91 | +for feature in response['features']: |
| 92 | + for link in feature['links']: |
| 93 | + if is_wis2_subscription_link(link): |
| 94 | + print('WIS2 subscription link') |
| 95 | +---- |
| 96 | + |
| 97 | +Using the `href` and `channel` properties of a matching link object, a client can connect and subscribe to data notifications for a given dataset. |
0 commit comments