opensensmapr | R Documentation |
The opensensmapr package provides functions for
retrieval of senseBox metadata,
retrieval of senseBox measurements,
general statistics about the openSenseMap database.
Additionally, helper functions are provided to ease the integration with the
sf
package for spatial analysis as well as
dplyr
for general data handling.
On the openSenseMap, measurements are provided by sensors which are assigned to a sensor station ("senseBox"). A senseBox consists of a collection of sensors, a location (-history), an ID, as well as metadata about its owner & placement. senseBoxes can be retrieved either by ID, or as a collection with optional filters on their metadata
osem_box
: Get metadata about a single box by its ID.
osem_boxes
: Get metadata about all boxes, optionally
filtered by their attributes.
The data is returned as a data.frame
with the class
sensebox
attached.
To help in getting an overview of the dataset additional functions are
implemented:
summary.sensebox()
: Aggregate the metadata about the given
list of senseBoxes.
plot.sensebox()
: Shows the spatial distribution of the given
list of senseBoxes on a map. Requires additional packages!
osem_phenomena
: Get a named list with
counts of the measured phenomena of the given list of senseBoxes.
There are two ways to retrieve measurements:
osem_measurements_archive
:
Downloads measurements for a single box from the openSenseMap archive.
This function does not provide realtime data, but is suitable for long time frames.
osem_measurements
:
This function retrieves (realtime) measurements from the API. It works for a
single phenomenon only, but provides various filters to select sensors by
a list of senseBoxes, previously retrieved through
osem_box
or osem_boxes
.
a geographic bounding box, which can be generated with the
sf
package.
a time frame
a exposure type of the given box
Use this function with caution for long time frames, as the API becomes quite slow is limited to 10.000 measurements per 30 day interval.
Data is returned as tibble
with the class osem_measurements
.
Count statistics about the database are provided with osem_counts
.
You can override the functions osem_endpoint
and osem_endpoint_archive
inside the package namespace:
assignInNamespace("osem_endpoint", function() "http://mynewosem.org", "opensensmapr")
The package aims to be compatible with the tidyverse. Helpers are implemented to ease the further usage of the retrieved data:
osem_as_sensebox
& osem_as_measurements
:
Transform a foreign object to a sensebox data.frame or osem_measurements
by attaching the required classes and attributes.
st_as_sf.sensebox
& st_as_sf.osem_measurements
:
Transform the senseBoxes or measurements into an sf
compatible format for spatial analysis.
filter.sensebox()
& mutate.sensebox()
: for use with
dplyr
.
Maintainer: Jan Stenkamp jan.stenkamp@uni-muenster.de [contributor]
Authors:
Norwin Roosen hello@nroo.de
Other contributors:
Daniel Nuest daniel.nuest@uni-muenster.de (ORCID) [contributor]
Report bugs at https://github.com/sensebox/opensensmapR/issues
openSenseMap API: https://api.opensensemap.org/
official openSenseMap API documentation: https://docs.opensensemap.org/
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.