From cf516c5530ccee79eb9a156b24dc51cbc481a1da Mon Sep 17 00:00:00 2001 From: eblondel Date: Fri, 4 Mar 2022 12:42:54 +0100 Subject: [PATCH] #9 consolidate dimensions subset handling --- R/WCSGetCoverage.R | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/R/WCSGetCoverage.R b/R/WCSGetCoverage.R index 69b540b..d7c1016 100644 --- a/R/WCSGetCoverage.R +++ b/R/WCSGetCoverage.R @@ -82,9 +82,16 @@ WCSGetCoverage <- R6Class("WCSGetCoverage", #time is not necessarily handled as character, need to identify with #srsName the crs if spatial or temporal - if(is.character(unlist(envelope$lowerCorner[,i])) & is.character(unlist(envelope$upperCorner[,i]))){ - if(is.null(time)) time <- envelope$upperCorner[,i] - subsetKvp <- sprintf("%s(\"%s\")",subset, time) + if(tolower(subset) %in% c("time", "elevation")){ + value <- NULL + if(tolower(subset)=="time") value <- time + if(tolower(subset)=="elevation") value <- elevation + if(is.null(value)) value <- envelope$upperCorner[,i] + if(is(value, "character")){ + subsetKvp <- sprintf("%s(\"%s\",\"%s\")",subset, value, value) + }else{ + subsetKvp <- sprintf("%s(%s,%s)",subset, value, value) + } } URLencode(subsetKvp) })