R client for opensensemap.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.8KB

  1. % Generated by roxygen2: do not edit by hand
  2. % Please edit documentation in R/measurement.R
  3. \name{osem_measurements}
  4. \alias{osem_measurements}
  5. \alias{osem_measurements.default}
  6. \alias{osem_measurements.bbox}
  7. \alias{osem_measurements.sensebox}
  8. \title{Get the Measurements of a Phenomenon on opensensemap.org}
  9. \usage{
  10. osem_measurements(x, ...)
  11. \method{osem_measurements}{default}(x, ...)
  12. \method{osem_measurements}{bbox}(x, phenomenon, exposure = NA, from = NA,
  13. to = NA, columns = NA, ..., endpoint = osem_endpoint(), progress = T)
  14. \method{osem_measurements}{sensebox}(x, phenomenon, exposure = NA,
  15. from = NA, to = NA, columns = NA, ..., endpoint = osem_endpoint(),
  16. progress = T)
  17. }
  18. \arguments{
  19. \item{x}{Depending on the method, either
  20. \enumerate{
  21. \item a \code{chr} specifying the phenomenon, see \code{phenomenon}
  22. \item a \code{\link[sf]{st_bbox}} to select sensors spatially,
  23. \item a \code{sensebox data.frame} to select boxes from which
  24. measurements will be retrieved,
  25. }}
  26. \item{...}{see parameters below}
  27. \item{phenomenon}{The phenomenon to retrieve measurements for}
  28. \item{exposure}{Filter sensors by their exposure ('indoor', 'outdoor', 'mobile')}
  29. \item{from}{A \code{POSIXt} like object to select a time interval}
  30. \item{to}{A \code{POSIXt} like object to select a time interval}
  31. \item{columns}{Select specific column in the output (see openSenseMap API documentation)}
  32. \item{endpoint}{The URL of the openSenseMap API}
  33. \item{progress}{Whether to print download progress information}
  34. }
  35. \value{
  36. An \code{osem_measurements data.frame} containing the
  37. requested measurements
  38. }
  39. \description{
  40. Measurements can be retrieved either for a set of boxes, or through a spatial
  41. bounding box filter. To get all measurements, the \code{default} function applies
  42. a bounding box spanning the whole world.
  43. }
  44. \section{Methods (by class)}{
  45. \itemize{
  46. \item \code{default}: Get measurements from \strong{all} senseBoxes.
  47. \item \code{bbox}: Get measurements by a spatial filter.
  48. \item \code{sensebox}: Get measurements from a set of senseBoxes.
  49. }}
  50. \examples{
  51. \donttest{
  52. # get measurements from all boxes
  53. m1 = osem_measurements('Windrichtung')
  54. }
  55. \donttest{
  56. # get measurements from sensors within a bounding box
  57. bbox = structure(c(7, 51, 8, 52), class = 'bbox')
  58. m2 = osem_measurements(bbox, 'Temperatur')
  59. points = sf::st_multipoint(matrix(c(7.5, 7.8, 51.7, 52), 2, 2))
  60. bbox2 = sf::st_bbox(points)
  61. m3 = osem_measurements(bbox2, 'Temperatur', exposure = 'outdoor')
  62. }
  63. \donttest{
  64. # get measurements from a set of boxes
  65. b = osem_boxes(grouptag = 'ifgi')
  66. m4 = osem_measurements(b, phenomenon = 'Temperatur')
  67. # ...or a single box
  68. b = osem_box('57000b8745fd40c8196ad04c')
  69. m5 = osem_measurements(b, phenomenon = 'Temperatur')
  70. }
  71. }
  72. \seealso{
  73. \href{https://docs.opensensemap.org/#api-Measurements-getDataMulti}{openSenseMap API documentation (web)}
  74. \code{\link{osem_boxes}}
  75. }