adapt to new API format

fixes #4
pull/17/head
Norwin 7 years ago
parent d5241e4817
commit 182ece1fa5
Signed by: norwin
GPG Key ID: 24BC059DE24C43A3

@ -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…
Cancel
Save