osem_boxes: Get a set of senseBoxes from the openSenseMap

osem_boxesR Documentation

Get a set of senseBoxes from the openSenseMap

Description

Boxes can be selected by a set of filters. Note that some filters do not work together:

  1. phenomenon can only be applied together with date or from / to

  2. date and from / to cannot be specified together

Usage

osem_boxes(
  exposure = NA,
  model = NA,
  grouptag = NA,
  date = NA,
  from = NA,
  to = NA,
  phenomenon = NA,
  bbox = NA,
  endpoint = osem_endpoint(),
  progress = TRUE,
  cache = NA
)

Arguments

exposure

Only return boxes with the given exposure ('indoor', 'outdoor', 'mobile')

model

Only return boxes with the given model

grouptag

Only return boxes with the given grouptag

date

Only return boxes that were measuring within ±4 hours of the given time

from

Only return boxes that were measuring later than this time

to

Only return boxes that were measuring earlier than this time

phenomenon

Only return boxes that measured the given phenomenon in the time interval as specified through date or from / to

bbox

Only return boxes that are within the given boundingbox, vector of 4 WGS84 coordinates. Order is: longitude southwest, latitude southwest, longitude northeast, latitude northeast. Minimal and maximal values are: -180, 180 for longitude and -90, 90 for latitude.

endpoint

The URL of the openSenseMap API instance

progress

Whether to print download progress information, defaults to TRUE

cache

Whether to cache the result, defaults to false. If a valid path to a directory is given, the response will be cached there. Subsequent identical requests will return the cached data instead.

Value

A sensebox data.frame containing a box in each row

See Also

openSenseMap API documentation (web)

osem_phenomena

osem_box

osem_clear_cache

Examples


## Not run: 
  # get *all* boxes available on the API
  b = osem_boxes()

  # get all boxes with grouptag 'ifgi' that are placed outdoors
  b = osem_boxes(grouptag = 'ifgi', exposure = 'outdoor')

  # get all boxes with model 'luftdaten_sds011_dht22'
  b = osem_boxes(grouptag = 'ifgi')

  # get all boxes that have measured PM2.5 in the last 4 hours
  b = osem_boxes(date = Sys.time(), phenomenon = 'PM2.5')

  # get all boxes that have measured PM2.5 between Jan & Feb 2018
  library(lubridate)
  b = osem_boxes(
    from = date('2018-01-01'),
    to = date('2018-02-01'),
    phenomenon = 'PM2.5'
  )

  # get all boxes from a custom (selfhosted) openSenseMap API
  b = osem_box(endpoint = 'http://api.my-custom-osem.com')

  # get all boxes and cache the response, in order to provide
  # reproducible results in the future. Also useful for development
  # to avoid repeated loading times!
  b = osem_boxes(cache = getwd())
  b = osem_boxes(cache = getwd())

  # get *all* boxes available on the API, without showing download progress
  b = osem_boxes(progress = FALSE)

## End(Not run)

opensensmapr documentation built on March 31, 2023, 11:45 p.m.