Examples
This page provides examples of common queries and how to use the OpenAQ API to address them. For more complex solutions we recommend using one of the official API clients or SDKs, see Libraries for more information.
Filtering locations by parameter
Where parameters_id 2 is the ID for PM2.5 and limits the number results to 1,000 per page.
Finding locations near a point
Where 136.90610,35.14942
is the central point in latitude,longitude and the
radius is 12,000 meters (12km) and limits the number results to 1,000 per page.
See the Geospatial queries guide for more
information on geospatial querying. This radius query represents an area like:
Finding locations in a bounding box
Where -118.668153,33.703935,-118.155358,34.337306
is the bounding box within
which to search and limits the number results to 1,000 per page. See the
Geospatial queries guide for more information on
geospatial querying. This bounding box represents an area like the following:
Fetch original measurements for a sensor
This fetches the original1 measurement values for sensor 3917, an Ozone sensor and limits the number results to 1,000 per page.
Fetch daily average values for a sensor
This fetches the daily average (mean) values, computed from the original measurement values for sensor 3917, an Ozone sensor, and limits the number results to 1,000 per page.
Fetch yearly average values, computed from daily averages for a sensor
This fetches the yearly average (mean) values, computed from the daily average values for sensor 3917, an Ozone sensor, and limits the number results to 1,000 per page.
Get the latest PM2.5 values
This fetches the latest PM2.5 (parameter ID 2) for all sensors across the OpenAQ dataset and limits the number results to 1,000 per page.
Footnotes
-
“original” indicates the original resolution as provided and ingested. ↩