% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/appdata.R
\docType{class}
\name{CitizenAir}
\alias{CitizenAir}
\title{CitizenAir app data}
\format{The CitizenAir object is an R6Class}
\usage{
CitizenAir
}
\description{
CitizenAir app data
}
\section{Fields}{

\describe{
\item{\code{endpoint}}{object of class \code{Endpoint} as returned by \code{as.Endpoint}}

\item{\code{stations}}{object of class \code{citizenair_stations} as returned by \code{\link{read_stations}}}

\item{\code{data}}{object of class \code{citizenair_userdata} as returned by \code{\link{read_citizenair}}}

\item{\code{closest_station}}{a character string with the id of the closest station.}
}}

\section{Methods}{

\describe{
  \item{\code{fetch_timeseries(id = "123", time_span)}}{Get timeseries for Station with \code{id} and a certain time_span The argument \code{timespan.} Passed on to \code{sensorweb4R::getData}}
  \item{\code{getStations()}}{Get a SpatialPointsDataFrame of all stations}
  \item{TODO}{TODO}
}
}

\examples{
library(sensorweb4R)
e <- as.Endpoint("http://geo.irceline.be/sos/api/v1")
ca <- CitizenAir$new(e)
ca
library(BelgiumMaps.StatBel)
data("BE_ADMIN_REGION", package = "BelgiumMaps.StatBel")
vlaanderen <- subset(BE_ADMIN_REGION, TX_RGN_DESCR_NL \%in\% "Vlaams Gewest")
ca <- CitizenAir$new(e, stations_area = vlaanderen)
ca
ca$getPhenomena()
ca$getPhenomenaLabel("20")

## get stations
library(sp)
x <- ca$getStations()
plot(x)
plot(ca$getStationsArea())

## get official measurements
library(lubridate)
x <- ca$fetch_timeseries(id = "1030")
period <- as.interval(as.POSIXct(Sys.Date() - 14), Sys.time())
x <- ca$fetch_timeseries(id = "1030", time_span = period)
## set citizen measurements
filename <- system.file(package = "citizenair", "data-raw", "citizenair-example.xls")
ca$setCitizenData(filename)
x <- ca$getCitizenData("meta")
x <- ca$getCitizenData("timeseries")
x <- ca$getCitizenData("phenomena")
x <- ca$getCitizenData("fileinfo")
ca$getClosestStation()
id <- ca$getClosestStation()
ca$setComparisonStation(id)
x <- ca$fetch_timeseries(id)
x <- ca$fetch_timeseries()
}
\keyword{datasets}
