En français

ECCC logo

TdM > MSC GeoMet > OGC API

OGC API

The Open Geospatial Consortium (OGC) API standards are a set of specifications developed by the OGC to facilitate the interoperable exchange of geospatial data and services over the web. These standards are designed to enable seamless integration and sharing of geospatial information across different systems, applications, and organizations. The following documentation will go over the basics of the OGC API - Features and OGC API - Coverages standards and provide examples of how to query GeoMet-OGC-API using these standards.

Main endpoints

GET / - Landing page

https://api.weather.gc.ca/

The GeoMet-OGC-API landing page with links to view the data collections, processes, and conformance classes implemented by the API.

GET /collections - All data collections

https://api.weather.gc.ca/collections

Retrieves information describing the set of supported collections and provides a list of collections with data type and a brief description.

GET collections/{collectionID} - Collection-specific information

https://api.weather.gc.ca/collections/hydrometric-daily-mean

Retrieves descriptive information about a specific collection, either of type feature or type coverage. For example, the URL above returns the root page for the Hydrometric Monitoring Stations feature collection.

GET /openapi - OpenAPI documentation

https://api.weather.gc.ca/openapi

The API documentation links provide a Swagger page of the API as a tool for developers to provide example request/response/query capabilities. A JSON representation is also provided.

GET /conformance - API conformance definition

https://api.weather.gc.ca/conformance

The conformance page provides a list of URLs corresponding to the OGC API conformance classes supported by GeoMet-OGC-API.

Common Query Parameters

The following section provides information regarding common query parameters often used when making requests to both feature and coverage collections. Query parameters are passed with the request URL using the ? character to separate the query parameter from the URL and the & character to separate multiple query parameters.

f - Format query parameter

https://api.weather.gc.ca/collections/?f=json

The format query paremeter is used to specify the format of the server response. Depending on the collection type, the value of the format query parameter could be one of of the following: html, json. The example above returns the list of available collections from GeoMet-OGC-API as a JSON object.

For feature collections, results can also be returned as a CSV file via ?f=csv.

For coverage collections, the output format of the coverage can be specified via this parameter. Depending on the collection and its supported output formats, the following values are supported: GRIB, GTiff, and NetCDF in GeoMet-OGC-API but their support is on a per coverage collection basis.

bbox - Bounding box query parameter

https://api.weather.gc.ca/collections/aqhi-observations-realtime/items?bbox=-71,46,-65,49

Retrieves information according to a specific region or bounding box. It is a rectangular area defined by two sets of coordinates that represent the minimum and maximum extents of the box. bbox coordinate values must be fall within the bounds of EPSG:4326. The coordinates specified must be in the following order: minX, minY, maxX, maxY.

datetime - Datetime query parameter

https://api.weather.gc.ca/collections/hydrometric-daily-mean/items?datetime=1972-10-30

Retrieves information according to a specific date, year or time interval. It is highly recommend to use RFC 3339 compliant datetime strings (i.e. YYYY-MM-DD or YYYY-MM-DDTHH:MM:SSZ). The datetime parameter can be used in conjunction with the .. keyword to specify a time extent. For example, datetime=2012-05-20/.. returns all items from 2015-05-20 onwards. datetime=../2015-11-11 returns all items older than 2015-11-11.

OGC API - Features

The OGC API - Features (OAFeat) standard provides a list of standardized specifications for querying vector-based geospatial data (points, lines and polygons) on the web. Listed below are example OGC-API feature collection endpoints, examples for spatial, temporal and property filtering, and further details regarding pagination.

GET collections/{collectionID}/items - Feature collection items

https://api.weather.gc.ca/collections/hydrometric-daily-mean/items

Returns items from a specified collection.

The above URL returns items from the hydrometric-daily-mean collection: Hydrometric Daily Mean Items

GET collections/{collectionID}/items/{itemID} - Single feature overview

https://api.weather.gc.ca/collections/hydrometric-daily-mean/items/01AA002

Returns the item with the corresponding ID from the requested collection and provides its full set of properties.

The above URL returns the item with ID 01AA002 from the hydrometric-stations collection: Item 01AA002

GET collections/{collectionID}/items?{query parameters} - Query a feature collection

Feature collection queries allow for spatial, temporal, and property filtering. Filter parameters can be combined to formulate a more complex query. The first parameter of a query must be specified with ? and subsequent parameters with &.

Below are a few examples of various types of queries, ranging from simple bbox and datetime filtering queries to more complex queries comprised of multiple query parameters. All queries are made to the hydometric-daily-mean feature collection.

Spatial

Query by bounding box (minx, miny,maxx, maxy).

https://api.weather.gc.ca/collections/hydrometric-stations/items?bbox=-71,46,-65,49

Returns items from the feature collection that intersect the provided bounding box: Map with selected area

Temporal

Query for an instantaneous value with a single date:

https://api.weather.gc.ca/collections/hydrometric-daily-mean/items?datetime=1972-10-30

Returns feature collection items that match the provided datetime value: Items from collection that match datetime

Query for a time interval:

https://api.weather.gc.ca/collections/hydrometric-daily-mean/items?datetime=1972-10-30/2010-07-31

Returns feature collection items that fall within the provided datetime range: Items from collection that fall within the provided datetime range

Query by time extent with the open ended .. keyword:

Property

Query by an entity collection property:

https://api.weather.gc.ca/collections/hydrometric-daily-mean/items?STATION_NUMBER=10CD001

Returns feature collection items that have STATION_NUMBER = 10CD001 Features by station number

Paging

Filter the list of properties of a queried element

Query a feature collection and return features for which the list of associated properties is restricted to the properties listed in the properties=. For example, the query below returns properties related to atmospheric pressure observations, in JSON format.

https://api.weather.gc.ca/collections/swob-realtime/items?lang=en&offset=0&sortby=-date_tm-value&url=CYRV&properties=date_tm-value%2Cmslp%2Cmslp-uom%2Cmslp-qa&f=json

Combining filter parameters

Query all hydrometric daily mean data from a single station between 2001 and 2010:

https://api.weather.gc.ca/collections/hydrometric-daily-mean/items?STATION_NUMBER=10CD001&datetime=2001-01-01/2010-12-31

Exporting to CSV format

Results from queries made against feature collections can be exported to the CSV format by adding &f=csv to the request, or by clicking on the CSV top-right icon on the collection page.

https://api.weather.gc.ca/collections/hydrometric-daily-mean/items?f=csv

Sorting

Results from a query can be sorted by using the sortby parameter. By default, the sort order is ascending. For a descending sort, add the - (minus) character prior to the property name. Sorting by multiple properties is supported by providing a comma-separated list of properties to the sortby query parameter.

&sortby=PROPERTY sorts the property in ascending order &sortby=-PROPERTY sorts the property in descending order.

Examples with the DATE property:

https://api.weather.gc.ca/collections/hydrometric-daily-mean/items?STATION_NUMBER=01AP004&offset=1000&limit=1000&sortby=DATE ascending

https://api.weather.gc.ca/collections/hydrometric-daily-mean/items?STATION_NUMBER=01AP004&offset=1000&limit=1000&sortby=-DATE descending


OGC API - Coverages

The OGC API - Coverages standard specifies the fundamental API building blocks for interacting with coverages (raster data). The spatial data community uses the term "coverage" to refer to homogeneous sets of values ​​located in space and time, such as data from spatiotemporal sensors, images, simulation and statistics.

GET collections/{coverageId} - Coverage collection landing page

https://api.weather.gc.ca/collections/climate:cmip5:historical:annual:anomaly

Retrieves detailed coverage metadata for the specified collection. The JSON response for this page displays the collection's geographic extent, grid size, temporal extent (if available), and any other additional dimensions. The collection root page also lists supported other collection-related links such as the collection schema (available fields) and coverage URLs for each format support by the collection.

GET collections/{coverageId}/schema - Coverage schema

https://api.weather.gc.ca/collections/climate:cmip5:historical:annual:anomaly/schema

Retrieves the schema of the coverage collection. The schema provides a list of available fields and their data types. The schema can be returned in JSON or HTML format and can be used to understand the available fields of the coverage data.

GET collections/{coverageId}/coverage - Coverage query with no parameters

https://api.weather.gc.ca/collections/climate:cmip5:historical:annual:anomaly/coverage

Returns the coverage data for the specified collection. The response will include all available data for the collection, which may be a large amount of data. It is recommended to use query parameters to filter the data returned by the coverage query. The data can be returned in different formats, such as CoverageJSON, GRIB, or NetCDF, depending on the collection and its supported output formats. See the links contained in the collection's root page for its available formats.

GET collections/{coverageId}/coverage?{params} - Coverage with query parameters

Queries against coverage collections allow for spatial, temporal, and field filtering against the n-dimensionsal space of the coverage itself//. The first parameter of a query must be specified with ? and subsequent parameters with &.

Spatial

Query by bounding box (minx, miny,maxx, maxy).

https://api.weather.gc.ca/collections/climate:cmip5:historical:annual:anomaly/coverage?f=json&bbox=-80.557251,42.561173,-75.135498,44.805224

Temporal

Query for an instantaneous value for a single period if a "time" axis label is available, for this specific coverage:

https://api.weather.gc.ca/collections/climate:cmip5:historical:annual:anomaly/coverage?f=json&datetime=1905

Query for a time interval:

https://api.weather.gc.ca/collections/climate:cmip5:historical:annual:anomaly/coverage?f=json&datetime=1901/1905

Schema field

Query for a specifc coverage field listed in the coverage schema via the properties query parameter. For example, the query below retrieves coverage data for the schema field named "sit" (sea ice thickness).

https://api.weather.gc.ca/collections/climate:cmip5:historical:annual:anomaly/coverage?properties=sit

Additional dimensions

Query additional dimensions (other than the spatial and temporal, which are queried via the bbox and datetime query parameters respectively) with the subset query parameter. Additional available dimensions are listed under the extent key at the coverage collection root via the JSON response only.

https://api.weather.gc.ca/collections/climate:cmip5:historical:annual:anomaly/coverage?subset=percentile(25)

Combination of filter parameters

Query the coverage with a spatial filter, temporal filter, and for a specific coverage field via the properties query parameter.

Returns in json format by default:

https://api.weather.gc.ca/collections/climate:cmip5:historical:annual:anomaly/coverage?bbox=-80.557251,42.561173,-75.135498,44.805224&properties=sfcWind&datetime=1901/1905

Export to GTiff or NetCDF format

Queries pointing to collections pages can be exported in GTiff format and NetCDF format if available. Consult the root of a given coverage collection to identify the available response data formats. For example:

https://api.weather.gc.ca/collections/climate:cmip5:projected:annual:absolute?f=json

Under the links key, the available values for the ?f parameter can be found. In this case the coverage data can be requested in JSON via ?f=json or as NetCDF via ?f=NetCDF.


OGC API - Advanced filtering with CQL2

GeoMet-OGC-API supports data filtering using Common Query Language (CQL2) though the ?filter query parameter in the HTTP request. CQL2 is an OGC standard designed to support advanced query of geospatial data and perform filtering directly on the server. By using CQL2, clients can reduce the amount of data returned and retrieve only data of interest.

CQL2 allows users to construct flexible and precise queries based on feature attributes and geometry.

  • Exact matches: = match features where an attribute has exact value;
  • Partial string or keywords: LIKE with % wildcard;
  • Comparison operators: >, <, >=, <= filter numeric or temporal values;
  • Logical operators:AND, OR, NOT compare conditions;
  • Spatial predicates: INTERCEPTS, DISJOINT filter based on geometry.

The full list of predicates available is accessible from the OGC CQL2 standard.

String values must be enclosed in single quotes '' and the property path (properties.attribute) must exactly match the attribute name defined in the collection schema (is case-sensitive). For GeoMet-OGC-API collections the synthax is:

https://api.weather.gc.ca/collections/{collectionID}/items?filter=<CQL2 expression>&<CQL2 expression>

1. Searching exact matches

1.1) Filter all meteorological bulletin that have the type CA, and are from issuing office AO.

CQL2: ?filter=properties.type=CA AND properties.issuing_office=AO

https://api.weather.gc.ca/collections/bulletins-realtime/items?filter=properties.type=CA AND properties.issuing_office=AO

1.2) Filter Climate - Daily Observations by attribute LOCAL_DAY. Here, LOCAL_DAY must be in capital letters, as defined in schema.

CQL2: ?filter=properties.LOCAL_DAY=15

https://api.weather.gc.ca/collections/climate-daily/items?filter=properties.LOCAL_DAY=15


2. Searching partial keywords

CQL supports partial text matching using the LIKE operator. It allows you to search for substrings within text attributes by using the % character as a wildcard, which can represent zero or more characters. The comparison is case-insensitive, but search string must be entered as lowercase and in between single quote. If the attribute value contains multiple words, the LIKE predicate is applied to the entire text value, matching the pattern against any substring within it.

2.1) Find all STATION_NAME containing the keyword LAKE. In that case, '%lak%' matches case insensitive keywords such as Lake, lak5, SPOKIN LAKE 4E, 2LAKE9, LaK.

CQL2: ?filter=properties.STATION_NAME LIKE '%lak%'

https://api.weather.gc.ca/collections/climate-normals/items?filter=properties.STATION_NAME LIKE '%lak%'

2.2) Filter only specific name of station whose name is (or is NOT) in a given list. The wildcard % can also be used in the list.

CQL2: ?filter=properties.STATION_NAME NOT IN ('lake', 'river')

https://api.weather.gc.ca/collections/climate-normals/items?filter=properties.STATION_NAME NOT IN ('lake', 'river')

2.3) To filter for more than a word, you need two different LIKE predicates. In this case, specifying 'quinsam' AND 'river' allows to filter for station name containing both 'quinsam' and 'river' keywords. Using OR would return station name containing either 'quinsam', 'river' or both.

CQL2: ?filter=properties.STATION_NAME LIKE '%quisam%' AND properties.STATION_NAME LIKE '%river%'

https://api.weather.gc.ca/collections/climate-normals/items?filter=properties.STATION_NAME LIKE '%quinsam%' AND properties.STATION_NAME LIKE '%river%'

2.4) Extracts station name starting with the letter K. You can place the wildcard % accordingly. Here, you see that it is not necessarily the first word of the station name that is a match. The LIKE predicate will compare every keywords of the text.

CQL2: ?filter=properties.STATION_NAME LIKE 'k%'

https://api.weather.gc.ca/collections/climate-normals/items?filter=properties.STATION_NAME LIKE 'k%'

CQL LIKE Wildcard Start

2.5) Extracts station name ending with the letter T. You can place the wildcard % accordingly. Here, you see that it is not necessarily the last word of the station name that is a match. The LIKE predicate will compare every keywords of the text.

CQL2: ?filter=properties.STATION_NAME LIKE '%t'

https://api.weather.gc.ca/collections/climate-normals/items?filter=properties.STATION_NAME LIKE '%t'

CQL LIKE Wildcard End

2.6) Searching meteorological bulletins by the identifier. It's not possible to manually search by id on the interface. Users can use CQL filters and leverage the bulletin filename nomenclature documentation.

CQL2: ?filter=properties.identifier LIKE '%WWCN70%'

https://api.weather.gc.ca/collections/bulletins-realtime/items/?filter=properties.identifier LIKE '%wwcn70%'

2.7) Search bulletins with partial keyword CYOY in the url.

CQL2: ?filter=properties.type=SA AND properties.issuer_code=CWAO AND properties.url LIKE '%cyoy%'

https://api.weather.gc.ca/collections/bulletins-realtime/items?filter=properties.type=SA AND properties.issuer_code=CWAO AND properties.url LIKE '%cyoy%'

?q= is the "full text search" capability in the MSC GeoMet OGC API. The equivalent query is:

https://api.weather.gc.ca/collections/bulletins-realtime/items?type=SA&issuer_code=CWAO&q=*CYOY*


2.8) Search bulletins by type and issuer code.

CQL2: ?filter=((properties.type=SA OR properties.type=SP) AND (properties.issuer_code=CWAO OR properties.issuer_code=CYOY))

https://api.weather.gc.ca/collections/bulletins-realtime/items/?filter=((properties.type=SA OR properties.type=SP) AND (properties.issuer_code=CWAO OR properties.issuer_code=CYOY))


3. Searching comparison operators

CQL2 supports numeric comparisons using operators.

3.1) Filter for temperature TEMP values less than 10°C.

CQL2: ?filter=properties.TEMP < 10

https://api.weather.gc.ca/collections/climate-hourly/items?filter=properties.TEMP < 10

3.2) Filter for Air Quality Health Index (AQHI) forecasts classified as low risk (1-3).

CQL2: ?filter=properties.aqhi<=3

https://api.weather.gc.ca/collections/aqhi-forecasts-realtime/items?filter=properties.aqhi<=3

3.3) Filter for AQHI observations lower than 2 that is in a specified bounding box (Nova Scotia).

CQL2: ?bbox=-70,42,-60,45&filter=properties.aqhi<2

https://api.weather.gc.ca/collections/aqhi-observations-realtime/items?bbox=-70,42,-60,45&filter=properties.aqhi<2

CQL Nova Scotia AQHI


4. Searching with logical operator

CQL supports range-based filtering using the BETWEEN operator. This operator is inclusive for both boundary values. Using BETWEEN is the equivalent of >= and <=, but improves readability.

synthax: [`NOT`] <attribute> BETWEEN <lower_bound> AND <upper_bound>

4.1) Filter items for temperature TEMP between 10°C and 12.5°C. For numeric values (number), no quotes required.

CQL2: ?filter=properties.TEMP BETWEEN 10 AND 12.5

https://api.weather.gc.ca/collections/climate-hourly/items?filter=properties.TEMP BETWEEN 10 AND 12.5

4.2) Filter for wind direction between north-northeast (NNE 23°) and northeast (NE 45°) and speed above 25 km/h.

CQL2: ?filter=properties.WIND_DIRECTION BETWEEN 23 AND 45 AND properties.WIND_SPEED >= 25

https://api.weather.gc.ca/collections/climate-hourly/items?filter=properties.WIND_DIRECTION BETWEEN 23 AND 45 AND properties.WIND_SPEED >= 25

4.3) Filter items between two datetime. Datetime values must be enclosed in single quotes, because it is defined as string in the collection queryables.

CQL2: ?filter=properties.LOCAL_DATE BETWEEN '2023-11-28 14:00:00' AND '2024-11-28 14:00:00'

https://api.weather.gc.ca/collections/climate-hourly/items?filter=properties.LOCAL_DATE BETWEEN '2023-11-28 14:00:00' AND '2024-11-28 14:00:00'

CQL Climate Hourly

4.4) Search for Air Quality Health Index observations with moderate risk only (BETWEEN 4 AND 6) in a BBOX.

CQL2: ?filter=BBOX(geometry, -140, 50, -85, 63) AND properties.aqhi BETWEEN 4 AND 6
CQL2: ?filter=BBOX(geometry, -140, 50, -85, 63) AND properties.aqhi>=7 (high risk)

https://api.weather.gc.ca/collections/aqhi-observations-realtime/items?filter=BBOX(geometry, -140, 50, -85, 63) AND properties.aqhi BETWEEN 4 AND 6


5. Spatial searches

Spatial searches allow users to personalize their queries based on geographical locations.

5.1) Find features that INTERSECTS a polygon. Returns all features that touch, crosses, fall in or overlaps a polygon. A polygon of x sides has to have x+1 points because the last point repeats the first one to close the shape of the polygon. Specify the longitude fist, then the latitude.

CQL2: ?filter=INTERSECTS(geometry, POLYGON((lon_1 lat_1,lon_2 lat_2,lon_3 lat_3,lon_4 lat_4,lon_1 lat_1)))
CQL2: ?filter=INTERSECTS(geometry, POLYGON((-56 47,-55 47,-55 48,-56 48,-56 47)))

https://api.weather.gc.ca/collections/swob-stations/items?filter=INTERSECTS(geometry, POLYGON((-56 47,-55 47,-55 48,-56 48,-56 47))) → Returns all SWOB stations intersecting the polygon that has a width of 1 degree (west-east longitudes) and a height of 1 degree (north-south latitude).


5.2) Find features with DISJOINT. Returns all features outside of a polygon, that do not intersect the geometry. It is the opposite of INTERSECTS.

CQL2: ?filter=DISJOINT(geometry, POLYGON((lon_1 lat_1,lon_2 lat_2,lon_3 lat_3,lon_4 lat_4,lon_1 lat_1)))
CQL2: ?filter=DISJOINT(geometry, POLYGON((-80 42,-50 42,-50 60,-80 60,-80 42)))

https://api.weather.gc.ca/collections/swob-stations/items?filter=DISJOINT(geometry, POLYGON((-80 42,-50 42,-50 60,-80 60,-80 42))) → Returns all SWOB stations that do not intersect the polygon that has a width of 30 degrees (longitudes) and 18 degrees (latitudes) in Eastern Canada.
CQL SWOB station


6. Examples of multi-parameter filtering

6.1) Filtering Climate - Daily Observations for a weather station in Lanaudiere for wet and warms summer months for a station where:

  • The CLIMATE_IDENTIFIER is 7014160 (L'Assomption station);
  • The MEAN_TEMPERATURE is 18°C and 28°C;
  • The TOTAL_PRECIPITATION is between 5 and 40 mm;
  • The LOCAL_YEAR is between 2010 and 2020;
  • The LOCAL_MONTH is between June and September (JJAS).
CQL2: ?filter=CLIMATE_IDENTIFIER = '7014160' AND properties.MEAN_TEMPERATURE BETWEEN 18 AND 28 AND properties.TOTAL_PRECIPITATION BETWEEN 5 AND 40 AND properties.LOCAL_YEAR BETWEEN 2010 AND 2020 AND properties.LOCAL_MONTH BETWEEN 6 AND 9

https://api.weather.gc.ca/collections/climate-daily/items?filter=CLIMATE_IDENTIFIER = '7014160' AND properties.MEAN_TEMPERATURE BETWEEN 18 AND 28 AND properties.TOTAL_PRECIPITATION BETWEEN 5 AND 40 AND properties.LOCAL_YEAR BETWEEN 2010 AND 2020 AND properties.LOCAL_MONTH BETWEEN 6 AND 9

CQL Assomption Station

6.2) Find all AQHI observations in a polygon around Calgary for today where the AQHI value is greater than 6 (high risk) within a polygon.

CQL2: ?filter=INTERSECTS(geometry,POLYGON((-114.2 50.9, -113.8 50.9, -113.8 51.2, -114.2 51.2, -114.2 50.9))) AND properties.aqhi>6

https://api.weather.gc.ca/collections/aqhi-observations-realtime/items?filter=INTERSECTS(geometry,POLYGON((-114.2 50.9, -113.8 50.9, -113.8 51.2, -114.2 51.2, -114.2 50.9))) AND properties.aqhi>4

CQL Intersects Calgary

6.3) Retrieve meteorogical stations meeting all of the following conditions:

  • Located within a specified polygon (Western canada region) with INTERSECTS;
  • Have a station containing the keyword "LAKE" with LIKE;
  • Reports minimum temperature BETWEEN -20 and -10°C;
  • Either have maximum speed gusts above 20 km/h.
CQL2: ?filter=INTERSECTS(geometry,POLYGON((-140 48,-95 48,-95 60,-140 60,-140 48))) AND properties.STATION_NAME LIKE '%lake%' AND properties.MIN_TEMPERATURE BETWEEN -20 AND -10 AND properties.SPEED_MAX_GUST >= 20

https://api.weather.gc.ca/collections/climate-daily/items?filter=INTERSECTS(geometry,POLYGON((-140 48,-95 48,-95 60,-140 60,-140 48))) AND properties.STATION_NAME LIKE '%lake%' AND properties.MIN_TEMPERATURE BETWEEN -20 AND -10 AND properties.SPEED_MAX_GUST >= 20

6.4a) Identify regions of elevated risk of wildfire (dry, hot and windy conditions) for the 2025 wildfire season.

  • During the wildfire 2025 season (April to October);
  • High temperatures (>= 30°C);
  • Low relative humidity (<= 30%);
  • Strong winds (speed >= 30 km/h).
Climate - Hourly Observations
CQL2: ?filter=properties.LOCAL_YEAR=2025 AND properties.LOCAL_HOUR=12 AND properties.LOCAL_MONTH BETWEEN 4 AND 10 AND properties.TEMP >=30 AND properties.RELATIVE_HUMIDITY <=30 AND properties.WIND_SPEED >= 30

https://api.weather.gc.ca/collections/climate-hourly/items?filter=properties.LOCAL_YEAR=2025 AND properties.LOCAL_HOUR=12 AND properties.LOCAL_MONTH BETWEEN 5 AND 8 AND properties.TEMP >=30 AND properties.RELATIVE_HUMIDITY <=30 AND properties.WIND_SPEED >= 30

6.4b) Using the same conditions as for the hourly observations, now we add the 24h total precipitation amount from Climate - Daily observations to account for the dryness. Total rainfall over 24 hours less than an arbitrary value of 3 mm.

Climate - Daily Observations
CQL2: ?filter=properties.LOCAL_YEAR=2025 AND properties.LOCAL_MONTH BETWEEN 4 AND 10 AND properties.MAX_TEMPERATURE>=30 AND properties.MIN_REL_HUMIDITY<=30 AND properties.SPEED_MAX_GUST>30 AND properties.TOTAL_PRECIPITATION<=3

https://api.weather.gc.ca/collections/climate-daily/items?filter=properties.LOCAL_YEAR=2025 AND properties.LOCAL_MONTH BETWEEN 5 AND 8 AND properties.MAX_TEMPERATURE>=30 AND properties.MIN_REL_HUMIDITY<=30 AND properties.SPEED_MAX_GUST>30 AND properties.TOTAL_PRECIPITATION<=3

CQL URL Wildfire CQL Wildfire


Curl command and Python

It was shown that it's possible to make HTTP request with CQL filters directly in the search bar of the search engine. It's also possible to retrieve the data via the curl command in the terminal. To save the output of what the request returns, use the -o option.

  • Using curl with the full encoded url.
curl [encoded_url] [option]
curl https://api.weather.gc.ca/collections/climate-hourly/items?filter=properties.WIND_DIRECTION%20BETWEEN%2023%20AND%2045%20AND%20properties.WIND_SPEED%20%3E=%2025%20&lang=en -o /path/to/output_file.json
  • Encoding the url directly with the --data-urlencode and -G GET request options. Users can add multiple --data-urlencode parameters (equivalent to &).
curl -G [basepath] --data-urlencode [CQL EXPRESSION]
curl -G "https://api.weather.gc.ca/collections/climate-hourly/items?" --data-urlencode "filter=properties.WIND_DIRECTION BETWEEN 23 AND 45 AND properties.WIND_SPEED >=25" --data-urlencode "lang=en"

Query with Python
To parse CQL filters and make HTTP requests, install the pygeofilter and requests Python modules.

pip3 install pygeofilter requests
import requests
import json
from pygeofilter.parsers.ecql import parse

# GeoMet-OGC-API endpoint.
api_url = "https://api.weather.gc.ca/collections/climate-daily/items"

# CQL filters.
cql_filter = (
    "properties.LOCAL_YEAR = 2025 AND "
    "properties.LOCAL_MONTH BETWEEN 6 AND 9 AND "
    "properties.MAX_TEMPERATURE >= 30"
)
# Validate CQL filters before API request.
try:
    parse(cql_filter)
except Exception as e:
    raise ValueError(f"Invalid CQL filter: {e}")

params = {
    "filter": cql_filter,
    "lang": "en",
    "limit": 100
}
# Sends GET request to the API and encode url.
response = requests.get(api_url, params=params)
print(f"The encoded url is: {response.url}")

# Format json in output file.
data = response.json()
climate_output_file = "climate_daysAbove30deg_JJAS_2025.json"
with open(climate_output_file, "w") as fh:
    json.dump(data, fh)