mirror of
https://github.com/sensebox/opensensmapr
synced 2025-06-08 10:06:08 +02: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
|
# extract nested lists for later use & clean them from the list
|
||||||
# to allow a simple data.frame structure
|
# to allow a simple data.frame structure
|
||||||
sensors = boxdata$sensors
|
sensors = boxdata$sensors
|
||||||
location = boxdata$loc
|
location = boxdata$currentLocation
|
||||||
boxdata[c('loc', 'sensors', 'image', 'boxType')] <- NULL
|
boxdata[c('loc', 'locations', 'currentLocation', 'sensors', 'image', 'boxType')] <- NULL
|
||||||
thebox = as.data.frame(boxdata, stringsAsFactors = F)
|
thebox = as.data.frame(boxdata, stringsAsFactors = F)
|
||||||
|
|
||||||
# parse timestamps (updatedAt might be not defined)
|
# parse timestamps (updatedAt might be not defined)
|
||||||
|
@ -120,10 +120,10 @@ parse_senseboxdata = function (boxdata) {
|
||||||
})[[1]])
|
})[[1]])
|
||||||
|
|
||||||
# extract coordinates & transform to simple feature object
|
# extract coordinates & transform to simple feature object
|
||||||
thebox$lon = location[[1]]$geometry$coordinates[[1]]
|
thebox$lon = location$coordinates[[1]]
|
||||||
thebox$lat = location[[1]]$geometry$coordinates[[2]]
|
thebox$lat = location$coordinates[[2]]
|
||||||
if (length(location[[1]]$geometry$coordinates) == 3)
|
if (length(location$coordinates) == 3)
|
||||||
thebox$height = location[[1]]$geometry$coordinates[[3]]
|
thebox$height = location$coordinates[[3]]
|
||||||
|
|
||||||
# attach a custom class for methods
|
# attach a custom class for methods
|
||||||
osem_as_sensebox(thebox)
|
osem_as_sensebox(thebox)
|
||||||
|
|
|
@ -115,7 +115,7 @@ parse_get_measurements_params = function (params) {
|
||||||
|
|
||||||
query = list(endpoint = params$endpoint, phenomenon = params$phenomenon)
|
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.null(params$bbox)) query$bbox = paste(params$bbox, collapse = ',')
|
||||||
|
|
||||||
if (!is.na(params$from) && !is.na(params$to)) {
|
if (!is.na(params$from) && !is.na(params$to)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue