Commit 32f40b13 authored by Jean-Marie Lepioufle's avatar Jean-Marie Lepioufle
Browse files

enable search by location

parent f2e4ae62
......@@ -15,15 +15,16 @@ luftlyr_get_data <- function(x,username,password) {
db$start(username,password)
tmp_st <- db$GetAQStations(stationIDs=x$stationObj$station_id,locationName=x$stationObj$locationName)
tmp_ts <- db$GetAQTimeseries(stationIDs=tmp_st$ST_ID,componentName=x$elementObj$element_id)
res <- db$GetAQData(stationIDs=tmp_st$ST_ID,
if (nrow(tmp_st)>0) {
res <- db$GetAQData(stationIDs=tmp_st$ST_ID,
timeSeriesIDs=tmp_ts$TS_ID,
fromDateTime=as.character(x$timeObj$fromDateTime()),
toDateTime=as.character(x$timeObj$toDateTime()))
db$stop()
#Negative values
res[which(res$TE_VALUE<0),"TE_VALUE"]<-NA
return(res)
db$stop()
#Negative values
res[which(res$TE_VALUE<0),"TE_VALUE"]<-NA
return(res)
} else stop("number of stations is null")
}
#' luftlyr_get_meta
......@@ -42,8 +43,10 @@ luftlyr_get_meta <- function(x,username,password) {
db <- luftkvalr::luftkvalr()
db$start(username,password)
tmp_st <- db$GetAQStations(stationIDs=x$stationObj$station_id,locationName=x$stationObj$locationName)
tmp_ts <- db$GetAQTimeseries(stationIDs=tmp_st$ST_ID,componentName=x$elementObj$element_id)
db$stop()
colnames(tmp_ts) <- c("ID","NAME","ALT","LAT","LON","TS_ID","CO_NAME","TS_Z1","TS_Z2")
return(tmp_ts[,c(1:5,7)])
if (nrow(tmp_st)>0) {
tmp_ts <- db$GetAQTimeseries(stationIDs=tmp_st$ST_ID,componentName=x$elementObj$element_id)
db$stop()
colnames(tmp_ts) <- c("ID","NAME","ALT","LAT","LON","TS_ID","CO_NAME","TS_Z1","TS_Z2")
return(tmp_ts[,c(1:5,7)])
} else stop("number of stations is null")
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment