From 182ece1fa52d32461e4d7c5fce951d585dd39068 Mon Sep 17 00:00:00 2001 From: Norwin Roosen Date: Wed, 29 Nov 2017 23:22:02 +0100 Subject: [PATCH] adapt to new API format fixes #4 --- R/box.R | 12 ++++++------ R/measurement.R | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/R/box.R b/R/box.R index ae44cb6..8490ed3 100644 --- a/R/box.R +++ b/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) diff --git a/R/measurement.R b/R/measurement.R index 3b9d9c5..94761bc 100644 --- a/R/measurement.R +++ b/R/measurement.R @@ -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)) {