-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
21 changed files
with
303 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ Authors@R: c(person("Emmanuel", "Blondel", role = c("aut", "cre"), email = "emma | |
person("Norbert", "Billet", role = c("ctb"))) | ||
Maintainer: Emmanuel Blondel <[email protected]> | ||
Depends: R (>= 2.15) | ||
Imports: R6, httr, XML (>= 3.96-1.1), sf, rgdal | ||
Imports: R6, httr, XML (>= 3.96-1.1), sf, rgdal, geometa | ||
Suggests: testthat | ||
Description: Provides an interface to OGC Web-Services (OWS). In a first step, the package supports the Common | ||
OGC Web-Services specifications the Web Feature Service (WFS). ows4R will progressively support other OGC web | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#' CSWGetRecordById | ||
#' | ||
#' @docType class | ||
#' @export | ||
#' @keywords OGC CSW GetRecordById | ||
#' @return Object of \code{\link{R6Class}} for modelling a CSW GetRecordById request | ||
#' @format \code{\link{R6Class}} object. | ||
#' | ||
#' @section Methods: | ||
#' \describe{ | ||
#' \item{\code{new(url, version, id)}}{ | ||
#' This method is used to instantiate a CSWGetRecordById object | ||
#' } | ||
#' \item{\code{getRequest()}}{ | ||
#' Get GetRecordById request | ||
#' } | ||
#' } | ||
#' | ||
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com> | ||
#' | ||
CSWGetRecordById <- R6Class("CSWGetRecordById", | ||
inherit = OWSRequest, | ||
private = list( | ||
name = "GetRecordById", | ||
defaultOutputSchema = "http://www.opengis.net/cat/csw/2.0.2" | ||
), | ||
public = list( | ||
initialize = function(op, url, version, id, ...) { | ||
namedParams <- list(request = private$name, version = version, id = id) | ||
outputSchema <- list(...)$outputSchema | ||
if(is.null(outputSchema)){ | ||
outputSchema <- private$defaultOutputSchema | ||
namedParams <- c(namedParams, outputSchema = outputSchema) | ||
} | ||
super$initialize(op, url, namedParams, mimeType = "text/xml", ...) | ||
|
||
#check response in case of ISO | ||
isoSchemas <- c("http://www.isotc211.org/2005/gmd","http://www.isotc211.org/2005/gfc") | ||
if(outputSchema %in% isoSchemas){ | ||
xmltxt <- as(self$response, "character") | ||
isMetadata <- regexpr("MD_Metadata", xmltxt)>0 | ||
isFeatureCatalogue <- regexpr("FC_FeatureCatalogue", xmltxt)>0 | ||
if(isMetadata && outputSchema == isoSchemas[2]){ | ||
outputSchema <- isoSchemas[1] | ||
message(sprintf("Metadata detected! Switch to schema '%s'!", outputSchema)) | ||
} | ||
if(isFeatureCatalogue && outputSchema == isoSchemas[1]){ | ||
outputSchema <- isoSchemas[2] | ||
message(sprintf("FeatureCatalogue detected! Switch to schema '%s'!", outputSchema)) | ||
} | ||
} | ||
|
||
#bindings | ||
self$response <- switch(outputSchema, | ||
"http://www.isotc211.org/2005/gmd" = { | ||
out <- NULL | ||
xmlObjs <- getNodeSet(self$response, "//ns:MD_Metadata", c(ns = outputSchema)) | ||
if(length(xmlObjs)>0){ | ||
xmlObj <- xmlObjs[[1]] | ||
out <- geometa::ISOMetadata$new() | ||
out$decode(xml = xmlObj) | ||
} | ||
out | ||
}, | ||
"http://www.isotc211.org/2005/gfc" = { | ||
out <- NULL | ||
xmlObjs <- getNodeSet(self$response, "//ns:FC_FeatureCatalogue", c(ns = outputSchema)) | ||
if(length(xmlObjs)>0){ | ||
xmlObj <- xmlObjs[[1]] | ||
out <- geometa::ISOFeatureCatalogue$new() | ||
out$decode(xml = xml) | ||
} | ||
out | ||
}, | ||
"http://www.opengis.net/cat/csw/2.0.2" = { | ||
warnings(sprintf("R binding not yet supported for '%s'", outputSchema)) | ||
self$response | ||
}, | ||
"http://www.w3.org/ns/dcat#" = { | ||
warnings(sprintf("R binding not yet supported for '%s'", outputSchema)) | ||
self$response | ||
} | ||
) | ||
} | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.