diff --git a/DESCRIPTION b/DESCRIPTION index 52e20d5..045306b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ows4R Version: 0.2 -Date: 2021-01-27 +Date: 2021-06-03 Title: Interface to OGC Web-Services (OWS) Authors@R: c(person("Emmanuel", "Blondel", role = c("aut", "cre"), email = "emmanuel.blondel1@gmail.com", comment = c(ORCID = "0000-0002-5870-5762")), person("Norbert", "Billet", role = c("ctb"))) diff --git a/R/WMSLayer.R b/R/WMSLayer.R index 5b4516e..c2a51ef 100644 --- a/R/WMSLayer.R +++ b/R/WMSLayer.R @@ -23,6 +23,34 @@ #' \item{\code{getKeywords()}}{ #' Get layer keywords #' } +#' \item{\code{getDefaultCRS()}}{ +#' Get layer default CRS +#' } +#' \item{\code{getBoundingBox()}}{ +#' Get layer bounding box +#' } +#' \item{\code{getBoundingBoxSRS()}}{ +#' Get layer bounding box SRS +#' } +#' \item{\code{getBoundingBoxCRS()}}{ +#' Get layer bounding box CRS +#' } +#' \item{\code{getStyle()}}{ +#' Get layer style +#' } +#' \item{\code{getDimensions()}}{ +#' Get layer dimensions +#' } +#' \item{\code{getTimeDimension()}}{ +#' Get layer time dimension +#' } +#' \item{\code{getElevationDimension()}}{ +#' Get layer elevation dimension +#' } +#' \item{\code{getFeatureInfo(srs, styles, feature_count, +#' x, y, width, height, bbox, info_format)}}{ +#' Get layer feature info +#' } #' } #' #' @note Abstract class used by \pkg{ows4R} @@ -46,6 +74,7 @@ WMSLayer <- R6Class("WMSLayer", boundingBoxSRS = NA, boundingBoxCRS = NA, style = NA, + dimensions = list(), #fetchLayer fetchLayer = function(xmlObj, version){ @@ -110,6 +139,22 @@ WMSLayer <- R6Class("WMSLayer", layerStyle <- xmlValue(xmlChildren(styleXML)$Name) } + dimensions <- list() + dimensionXML <- children[names(children)=="Dimension"] + if(!is.null(dimensionXML)){ + dimensions <- lapply(dimensionXML, function(dimXML){ + return(list( + name = xmlGetAttr(dimXML, "name"), + units = xmlGetAttr(dimXML, "units"), + multipleValues = xmlGetAttr(dimXML, "multipleValues") == "true", + current = xmlGetAttr(dimXML, "current") == "true", + default = xmlGetAttr(dimXML, "default"), + values = unlist(strsplit(gsub("\n", "", gsub(" ", "", xmlValue(dimXML))),",")) + )) + }) + names(dimensions) <- sapply(dimensionXML, xmlGetAttr, "name") + } + layer <- list( name = layerName, title = layerTitle, @@ -119,7 +164,8 @@ WMSLayer <- R6Class("WMSLayer", boundingBox = layerBoundingBox, boundingBoxSRS = layerSRS, boundingBoxCRS = layerCRS, - style = layerStyle + style = layerStyle, + dimensions = dimensions ) return(layer) @@ -147,6 +193,7 @@ WMSLayer <- R6Class("WMSLayer", private$boundingBoxSRS = layer$boundingBoxSRS private$boundingBoxCRS = layer$boundingBoxCRS private$style = layer$style + private$dimensions = layer$dimensions }, @@ -195,6 +242,21 @@ WMSLayer <- R6Class("WMSLayer", return(private$style) }, + #getDimensions + getDimensions = function(){ + return(private$dimensions) + }, + + #getTimeDimension + getTimeDimension = function(){ + return(private$dimensions[["time"]]) + }, + + #getElevationDimension + getElevationDimension = function(){ + return(private$dimensions[["elevation"]]) + }, + #getFeatureInfo getFeatureInfo = function(srs = NULL, styles = NULL, feature_count = 1, x, y, width, height, bbox, diff --git a/R/ows4R.R b/R/ows4R.R index 4e2e9d4..3306371 100644 --- a/R/ows4R.R +++ b/R/ows4R.R @@ -16,7 +16,7 @@ #' Type: \tab Package\cr #' Version #' : \tab 0.2\cr -#' Date: \tab 2021-01-27\cr +#' Date: \tab 2021-05-03\cr #' License: \tab MIT\cr #' LazyLoad: \tab yes\cr #' } diff --git a/man/WMSLayer.Rd b/man/WMSLayer.Rd index cf669c1..4a768a4 100644 --- a/man/WMSLayer.Rd +++ b/man/WMSLayer.Rd @@ -34,6 +34,34 @@ Abstract class used by \pkg{ows4R} \item{\code{getKeywords()}}{ Get layer keywords } + \item{\code{getDefaultCRS()}}{ + Get layer default CRS + } + \item{\code{getBoundingBox()}}{ + Get layer bounding box + } + \item{\code{getBoundingBoxSRS()}}{ + Get layer bounding box SRS + } + \item{\code{getBoundingBoxCRS()}}{ + Get layer bounding box CRS + } + \item{\code{getStyle()}}{ + Get layer style + } + \item{\code{getDimensions()}}{ + Get layer dimensions + } + \item{\code{getTimeDimension()}}{ + Get layer time dimension + } + \item{\code{getElevationDimension()}}{ + Get layer elevation dimension + } + \item{\code{getFeatureInfo(srs, styles, feature_count, + x, y, width, height, bbox, info_format)}}{ + Get layer feature info + } } } diff --git a/man/ows4R.Rd b/man/ows4R.Rd index 48cf852..e89cb3d 100644 --- a/man/ows4R.Rd +++ b/man/ows4R.Rd @@ -17,7 +17,7 @@ Web Processing Service (WPS). Type: \tab Package\cr Version : \tab 0.2\cr - Date: \tab 2021-01-27\cr + Date: \tab 2021-05-03\cr License: \tab MIT\cr LazyLoad: \tab yes\cr }