Retrieve pollution data in IMECAs by geographic zone from the air quality server at Consultas

get_zone_imeca(criterion, pollutant, zone, start_date, end_date,
  showWarnings = TRUE, show_messages = TRUE)



The type of data to download. One of the following options:

  • "HORARIOS" - Hourly data

  • "MAXIMOS"" - Daily maximums


The type of pollutant to download. One or more of the following options:

  • "SO2" - Sulfur Dioxide

  • "CO" - Carbon Monoxide

  • "NO2" - Nitrogen Dioxide

  • "O3" - Ozone

  • "PM10" - Particulate matter 10 micrometers or less

  • "TC"- All the pollutants


The geographic zone for which to download data. One or more of the following:

  • "NO" - Noroeste

  • "NE" - Noreste

  • "CE" - Centro

  • "SO" - Suroeste

  • "SE" - Sureste

  • "TZ" - All zones


The start date in YYYY-MM-DD format (earliest possible value is 2008-01-01).


The end date in YYYY-MM-DD format.


deprecated; you can use the function suppressWarnings instead.


show a message about issues with performing the conversion


A data.frame with pollution data measured in IMECAs, by geographic zone. The hours correspond to the Etc/GMT+6 timezone, with no daylight saving time


Note that in 2015 it was determined that the stations with codes ACO, AJU, INN, MON and MPA would no longer be taken into consideration when computing the pollution index because they didn't meet the objectives of monitoring air quality. They are no longer included in the index, even if they are still part of the SIMAT (Sistema de Monitoreo Atmosférico de la Ciudad de México). Thus, even if they are located inside a zone, they are not included in the pollution values for that zone.

The different geographic zones were defined in the Gaceta Oficial de la Ciudad de México No. 230, 27 de Diciembre de 2016.

Zona Centro: Benito Juárez, Cuauhtémoc, Iztacalco and Venustiano Carranza.

Zona Noreste: Gustavo A. Madero, Coacalco de Berriozábal, Chicoloapan, Chimalhuacán, Ecatepec de Morelos, Ixtapaluca, La Paz, Nezahualcóyotl and Tecámac.

Zona Noroeste: Azcapotzalco, Miguel Hidalgo, Atizapán de Zaragoza, Cuautitlán, Cuautitlán Izcalli, Naucalpan de Juárez, Nicolás Romero, Tlalnepantla de Baz and Tultitlán.

Zona Sureste: Iztapalapa, Milpa Alta, Tláhuac, Xochimilco, Chalco and Valle de Chalco.

Zona Suroeste: Álvaro Obregón, Coyoacán, Cuajimalpa, Magdalena Contreras, Tlalpan and Huixquilucan.

See also

zones a data.frame containing the municipios belonging to each zone, and Índice de calidad del aire por zonas

Other IMECA functions: get_latest_imeca, get_station_imeca


## There was a regional (NE) PM10 pollution emergency on Jan 6, 2017 get_zone_imeca("MAXIMOS", "PM10", "NE", "2017-01-05", "2017-01-08", show_messages = FALSE)
#> date zone pollutant unit value #> 1 2017-01-05 NE PM10 IMECA 131 #> 2 2017-01-06 NE PM10 IMECA 158 #> 3 2017-01-07 NE PM10 IMECA 156 #> 4 2017-01-08 NE PM10 IMECA 118
## There was an ozone pollution emergency on May 15, 2017 get_zone_imeca("MAXIMOS", "O3", "TZ", "2017-05-15", "2017-05-15", show_messages = FALSE)
#> date zone pollutant unit value #> 1 2017-05-15 NO O3 IMECA 106 #> 2 2017-05-15 NE O3 IMECA 118 #> 3 2017-05-15 CE O3 IMECA 134 #> 4 2017-05-15 SO O3 IMECA 151 #> 5 2017-05-15 SE O3 IMECA 144
# NOT RUN { ## Download daily maximum PM10 data (particulate matter 10 micrometers or ## less in diameter) from 2015-01-01 to 2016-03-20 for all geographic zones df <- get_zone_imeca("MAXIMOS", "PM10", "TZ", "2015-01-01", "2016-03-20") head(df) ## Download hourly O3 pollution data for May 15, 2017. Only the suroeste zone df2 <- get_zone_imeca("HORARIOS", "O3", "SO", "2017-05-15", "2017-05-15") ## Convert to local Mexico City time df2$mxc_time <- format(as.POSIXct(paste0(df2$date, " ", df2$hour, ":00"), tz = "Etc/GMT+6"), tz = "America/Mexico_City") head(df2) # }