Read from the package's own PHP files at the commit 81badfd49744: its namespaces, classes, interfaces and enums, their public constants, properties and methods with their PHPDoc, and the options its factories take. Nothing of it is run.
OpenAqSourceclassOpenAQ, the open platform of air quality measurements, through its API v3 (api.openaq.org/v3): the measurements of the nearest location of a point that measures the pollutant asked - PM2.5, PM10, NO2, O3, SO2, CO, black carbon... by OpenAQ's parameter names - as hourly averages or daily averages, from the stations of governments, research and low-cost sensor networks the world over.
4 methods · 3 constants
OpenAqSourceFactoryclassOpenAQ (API v3): hourly and daily averages of air quality at the nearest location of a point. A key is required: OpenAQ answers 401 without one.
4 options
Omnilab\OpenAq
OpenAqSource class
final class OpenAqSource extends HttpSource OpenAqSource.php:26
OpenAQ, the open platform of air quality measurements, through its API v3 (api.openaq.org/v3): the measurements of the nearest location of a point that measures the pollutant asked - PM2.5, PM10, NO2, O3, SO2, CO, black carbon... by OpenAQ's parameter names - as hourly averages or daily averages, from the stations of governments, research and low-cost sensor networks the world over.
A key is required (X-API-Key): OpenAQ answers 401 to a call without one. 60 calls a minute and 2,000 an hour per key: a second between two calls by default.
const BASE_URI = 'https://api.openaq.org/v3/'const PAGE = 1000The most results a page holds here.
const MAX_RADIUS = 25.0The largest radius OpenAQ searches around a point, in kilometres.
OpenAqSource::__construct()
public function __construct(HttpClientInterface $http, readonly float $radius = 10.0, string $baseUri = self::BASE_URI, array $headers = [], float $throttle = 1.0)$radiushow far from a Point a location is looked for, in kilometres (25 at most)
OpenAqSource::getName()
public function getName(): stringOpenAqSource::capabilities()
public function capabilities(): arrayOpenAqSource::series()
public function series(SeriesQuery $query): arrayThe series of the nearest location of a Point that measures each variable (OpenAQ's parameter names: "pm25", "pm10", "no2", "o3", "so2", "co", "bc", "temperature", "relativehumidity"...), within the configured radius: SeriesQuery::HOURLY, the hourly averages (a point at each hour's start), or DAILY, the daily averages OpenAQ computes in the location's local days. The unit is the sensor's (µg/m³, ppm...).
A variable no location near measures: a series without points, at the point asked. The period defaults to the last seven days; a date without a time is the whole day.
OpenAqSourceFactory class
final class OpenAqSourceFactory extends SourceFactory OpenAqSourceFactory.php:21
OpenAQ (API v3): hourly and daily averages of air quality at the nearest location of a point. A key is required: OpenAQ answers 401 without one.
options: api_key: '%env(OPENAQ_API_KEY)%' # sent as X-API-Key; from explore.openaq.org/register mailto: 'support@glitchr.io' # in the User-Agent radius_km: 10 # how far from a Point a location is looked for (25 at most) throttle: 1 # seconds between two calls: 60 a minute per key base_uri: 'https://api.openaq.org/v3/'
Options
| Option | Default | |
|---|---|---|
api_key | null | |
radius_km | 10.0 | |
throttle | 1.0 | |
base_uri | OpenAqSource::BASE_URI |