From 40a198cfafe99ac4fab9c83f01b85648a9db1a85 Mon Sep 17 00:00:00 2001 From: Bennici Date: Mon, 12 Jul 2021 11:47:52 +0200 Subject: [PATCH] #43 add option 'time_format' to getDimensions and getTimeDimension for converting time dimension as posix format if time_format='posix (default ='character') --- R/WMSLayer.R | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/R/WMSLayer.R b/R/WMSLayer.R index b50b0b9..6a7464c 100644 --- a/R/WMSLayer.R +++ b/R/WMSLayer.R @@ -243,13 +243,23 @@ WMSLayer <- R6Class("WMSLayer", }, #getDimensions - getDimensions = function(){ - return(private$dimensions) + getDimensions = function(time_format = "character"){ + dimensions <- private$dimensions + if(time_format=="posix"){ + dimensions[["time"]]$default<-as.POSIXct(dimensions[["time"]]$default,format="%Y-%m-%dT%H:%M:%OSZ") + dimensions[["time"]]$values<-as.POSIXct(dimensions[["time"]]$values,format="%Y-%m-%dT%H:%M:%OSZ") + } + return(dimensions) }, #getTimeDimension - getTimeDimension = function(){ - return(private$dimensions[["time"]]) + getTimeDimension = function(time_format = "character"){ + time_dimensions <- private$dimensions[["time"]] + if(time_format=="posix"){ + time_dimensions$default<-as.POSIXct(time_dimensions$default,format="%Y-%m-%dT%H:%M:%OSZ") + time_dimensions$values<-as.POSIXct(time_dimensions$values,format="%Y-%m-%dT%H:%M:%OSZ") + } + return(time_dimensions) }, #getElevationDimension @@ -260,7 +270,7 @@ WMSLayer <- R6Class("WMSLayer", #getFeatureInfo getFeatureInfo = function(srs = NULL, styles = NULL, feature_count = 1, x, y, width, height, bbox, - info_format = "application/vnd.ogc.gml", + info_format = "text/xml", ...){ if(is.null(styles)){