Skip to content

Commit

Permalink
#43 getfeatureinfo compatibility with wms 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Jan 27, 2021
1 parent 75df72b commit 165c61b
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ows4R
Version: 0.2
Date: 2020-10-30
Date: 2021-01-27
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")))
Expand Down
4 changes: 2 additions & 2 deletions R/WMSClient.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ WMSClient <- R6Class("WMSClient",
},

#getFeatureInfo
getFeatureInfo = function(layer, srs = NULL, crs = NULL,
getFeatureInfo = function(layer, srs = NULL,
styles = NULL, feature_count = 1,
x, y, width, height, bbox,
info_format = "application/vnd.ogc.gml",
Expand All @@ -80,7 +80,7 @@ WMSClient <- R6Class("WMSClient",
features <- NULL
if(is(wmsLayer,"WMSLayer")){
features <- wmsLayer$getFeatureInfo(
srs = srs, crs = crs, styles = styles, feature_count = feature_count,
srs = srs, styles = styles, feature_count = feature_count,
x = x, y = y, width = width, height = height, bbox = bbox,
info_format = info_format,
...
Expand Down
13 changes: 10 additions & 3 deletions R/WMSGetFeatureInfo.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
#'
#' @section Methods:
#' \describe{
#' \item{\code{new(op, url, version, typeName, logger, ...)}}{
#' \item{\code{new(op, url, version, layers, srs, styles, feature_count,
#' x, y, width, height, bbox, info_format, logger, ...)}}{
#' This method is used to instantiate a WMSGetFeatureInfo object
#' }
#' }
Expand All @@ -23,7 +24,7 @@ WMSGetFeatureInfo <- R6Class("WMSGetFeatureInfo",
name = "GetFeatureInfo"
),
public = list(
initialize = function(op, url, version, layers, srs, crs, styles, feature_count = 1,
initialize = function(op, url, version, layers, srs, styles, feature_count = 1,
x, y, width, height, bbox, info_format = "application/vnd.ogc.gml",
logger = NULL, ...) {

Expand All @@ -37,14 +38,14 @@ WMSGetFeatureInfo <- R6Class("WMSGetFeatureInfo",
if(is(bbox, "matrix")){
bbox <- paste0(bbox, collapse=",")
}
#case of 1.1
namedParams <- list(
service = "WMS",
version = version,
FORMAT = "image/png",
TRANSPARENT = "true",
QUERY_LAYERS = layers,
SRS = srs,
CRS = crs,
LAYERS = layers,
STYLES = styles,
FEATURE_COUNT = format(feature_count, scientific = FALSE),
Expand All @@ -53,6 +54,12 @@ WMSGetFeatureInfo <- R6Class("WMSGetFeatureInfo",
BBOX = bbox,
INFO_FORMAT = info_format
)
if(startsWith(version, "1.3")){
names(namedParams)[which(names(namedParams)=="SRS")] <- "CRS"
names(namedParams)[which(names(namedParams)=="X")] <- "I"
names(namedParams)[which(names(namedParams)=="Y")] <- "J"
}

vendorParams <- list(...)
if(length(vendorParams)>0) namedParams <- c(namedParams, vendorParams)
namedParams <- namedParams[!sapply(namedParams, is.null)]
Expand Down
2 changes: 1 addition & 1 deletion R/ows4R.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#' Type: \tab Package\cr
#' Version
#' : \tab 0.2\cr
#' Date: \tab 2020-10-30\cr
#' Date: \tab 2021-01-27\cr
#' License: \tab MIT\cr
#' LazyLoad: \tab yes\cr
#' }
Expand Down
3 changes: 2 additions & 1 deletion man/WMSGetFeatureInfo.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/ows4R.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 165c61b

Please sign in to comment.