Public dataset · Geography, weather and climate
OpenAQ Global Air Quality in BigQuery
Air quality measurements (pollutant, value, unit, time) from OpenAQ monitoring locations worldwide in one table of 5.6 million rows and 738 MiB, with a GEOGRAPHY column for spatial queries. The table was last updated in June 2022, so treat it as a snapshot.
OpenAQ is an open-source project that collects air quality data from public sources. The dataset description says the data covers 5,490 locations in 47 countries and that the dataset only includes the most current measurement available for each location, not historical data. It also states an hourly update frequency, but the description begins with "Data Updated On: 2022-06-23" and the table metadata shows the same last-modified date, so the table is effectively a frozen snapshot from June 2022.
The single table global_air_quality has one row per location and pollutant: location, city, country, pollutant, value, unit, timestamp, source_name, latitude, longitude, averaged_over_in_hours and location_geom, a GEOGRAPHY point you can use with ST_DWITHIN and ST_DISTANCE.
Tables and sizes
| Table | Rows | Size | Full scan | Layout |
|---|---|---|---|---|
global_air_qualityOne row per location and pollutant with value, unit, timestamp and a GEOGRAPHY point. | 5,594,614 | 738 MiB | under $0.01 | None |
Example queries
Highest PM2.5 readings
Top locations by PM2.5 value. Seven columns, 341 MiB.
SELECT
city,
country,
location,
value,
unit,
timestamp
FROM `bigquery-public-data.openaq.global_air_quality`
WHERE pollutant = 'pm25'
ORDER BY value DESC
LIMIT 10;Average PM2.5 by country
Keeps only non-negative values as a basic sanity filter. Reads four columns: 185 MiB.
SELECT
country,
COUNT(DISTINCT location) AS locations,
ROUND(AVG(value), 1) AS avg_pm25
FROM `bigquery-public-data.openaq.global_air_quality`
WHERE pollutant = 'pm25'
AND value >= 0
GROUP BY country
ORDER BY avg_pm25 DESC;Measurements within 25 km of a point
Uses the location_geom GEOGRAPHY column. The point is central Paris.
SELECT
location,
pollutant,
value,
unit,
ROUND(ST_DISTANCE(location_geom, ST_GEOGPOINT(2.3522, 48.8566)) / 1000, 1) AS km
FROM `bigquery-public-data.openaq.global_air_quality`
WHERE ST_DWITHIN(location_geom, ST_GEOGPOINT(2.3522, 48.8566), 25000)
ORDER BY km, pollutant;All columns for one country (expensive)
WHERE country = 'US' does not prune anything: this reads the full 738 MiB.
SELECT *
FROM `bigquery-public-data.openaq.global_air_quality`
WHERE country = 'US';Querying it cheaply
- The table is not partitioned or clustered, so
WHERE country = ...orWHERE pollutant = ...filters rows but not bytes. Only selecting fewer columns lowers cost. location_geomis one of the heavier columns. Leave it out unless you need spatial functions;latitudeandlongitudeare cheaper for display.- Every query here costs at most 738 MiB. The bigger risk is analysing stale data: check
MAX(timestamp)before you build anything on it.
FAQ
Is the OpenAQ BigQuery dataset still updated?
No. The dataset description says "Data Updated On: 2022-06-23" and the table was last modified that day. For current readings, use the OpenAQ API directly.
Is the OpenAQ dataset free to query?
Google pays for storing public datasets, so you never pay storage for them. You pay only for the bytes your queries scan, billed to your own project at the on-demand rate, and the first 1 TiB scanned each month is free. See BigQuery pricing.
How much does it cost to query OpenAQ in BigQuery?
A full scan is 738 MiB, and the dry runs above range from 185 MiB to 738 MiB. That is under 0.1% of the monthly free TiB per query.
Related datasets
All public datasets · BigQuery cost queries · Pricing calculator
