mirror of
https://github.com/sensebox/opensensmapr
synced 2025-02-20 11:53:57 +01:00
parent
d5241e4817
commit
182ece1fa5
2 changed files with 7 additions and 7 deletions
12
R/box.R
12
R/box.R
|
@ -100,8 +100,8 @@ parse_senseboxdata = function (boxdata) {
|
|||
# extract nested lists for later use & clean them from the list
|
||||
# to allow a simple data.frame structure
|
||||
sensors = boxdata$sensors
|
||||
location = boxdata$loc
|
||||
boxdata[c('loc', 'sensors', 'image', 'boxType')] <- NULL
|
||||
location = boxdata$currentLocation
|
||||
boxdata[c('loc', 'locations', 'currentLocation', 'sensors', 'image', 'boxType')] <- NULL
|
||||
thebox = as.data.frame(boxdata, stringsAsFactors = F)
|
||||
|
||||
# parse timestamps (updatedAt might be not defined)
|
||||
|
@ -120,10 +120,10 @@ parse_senseboxdata = function (boxdata) {
|
|||
})[[1]])
|
||||
|
||||
# extract coordinates & transform to simple feature object
|
||||
thebox$lon = location[[1]]$geometry$coordinates[[1]]
|
||||
thebox$lat = location[[1]]$geometry$coordinates[[2]]
|
||||
if (length(location[[1]]$geometry$coordinates) == 3)
|
||||
thebox$height = location[[1]]$geometry$coordinates[[3]]
|
||||
thebox$lon = location$coordinates[[1]]
|
||||
thebox$lat = location$coordinates[[2]]
|
||||
if (length(location$coordinates) == 3)
|
||||
thebox$height = location$coordinates[[3]]
|
||||
|
||||
# attach a custom class for methods
|
||||
osem_as_sensebox(thebox)
|
||||
|
|
|
@ -115,7 +115,7 @@ parse_get_measurements_params = function (params) {
|
|||
|
||||
query = list(endpoint = params$endpoint, phenomenon = params$phenomenon)
|
||||
|
||||
if (!is.null(params$boxes)) query$boxIds = paste(params$boxes$X_id, collapse = ',')
|
||||
if (!is.null(params$boxes)) query$boxId = paste(params$boxes$X_id, collapse = ',')
|
||||
if (!is.null(params$bbox)) query$bbox = paste(params$bbox, collapse = ',')
|
||||
|
||||
if (!is.na(params$from) && !is.na(params$to)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue