Skip to content

Commit

Permalink
eblondel#43 add option 'time_format' to getDimensions and getTimeDime…
Browse files Browse the repository at this point in the history
…nsion for converting time dimension as posix format if time_format='posix (default ='character')
  • Loading branch information
abennici committed Jul 12, 2021
1 parent 80cc927 commit 40a198c
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions R/WMSLayer.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)){
Expand Down

0 comments on commit 40a198c

Please sign in to comment.