Skip to content

Commit

Permalink
fix #128
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Jun 26, 2024
1 parent 720e4d5 commit fd861f3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 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.4
Date: 2024-06-25
Date: 2024-06-26
Title: Interface to OGC Web-Services (OWS)
Authors@R: c(person("Emmanuel", "Blondel", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0002-5870-5762")),
person("Alexandre", "Bennici", role = c("ctb"), comment = c(ORCID = "0000-0003-2160-3487")),
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- [#123](https://github.com/eblondel/ows4R/issues/123) Missing axis labels handling for WCS coverage envelope
- [#124](https://github.com/eblondel/ows4R/issues/124) Optimize WFS getFeatures depending on the outputFormat
- [#126](https://github.com/eblondel/ows4R/issues/126) Add skipXmlComments as internal arg for OWS http XML requests
- [#128](https://github.com/eblondel/ows4R/issues/128) Make feature validation as arg, and default to TRUE for backward compatibility

## [ows4R 0.3-6](https://github.com/eblondel/ows4R) | [![CRAN_Status_Badge](https://img.shields.io/badge/CRAN-published-blue.svg)](https://github.com/eblondel/ows4R)

Expand Down
8 changes: 3 additions & 5 deletions R/WFSFeatureType.R
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ WFSFeatureType <- R6Class("WFSFeatureType",
#'@description Get features
#'@param typeName the name of the feature type
#'@param ... any other parameter to pass to the \link{WFSGetFeature} request
#'@param validate Whether features have to be validated vs. the feature type description. Default is \code{TRUE}
#'@param outputFormat output format
#'@param paging paging. Default is \code{FALSE}
#'@param paging_length number of features to request per page. Default is 1000
Expand All @@ -285,6 +286,7 @@ WFSFeatureType <- R6Class("WFSFeatureType",
#'@param cl optional cluster object for parallel cluster approaches using eg. \code{parallel::makeCluster}
#'@return features as object of class \code{sf}
getFeatures = function(...,
validate = TRUE,
outputFormat = NULL,
paging = FALSE, paging_length = 1000,
parallel = FALSE, parallel_handler = NULL, cl = NULL){
Expand Down Expand Up @@ -367,7 +369,6 @@ WFSFeatureType <- R6Class("WFSFeatureType",
}

read_features = TRUE
validate_features = TRUE

#write the file to disk
tempf = tempfile()
Expand All @@ -387,19 +388,16 @@ WFSFeatureType <- R6Class("WFSFeatureType",
"application/json" = {
destfile = paste0(tempf,".json")
write(obj, destfile)
validate_features = FALSE
},
"json" = {
destfile = paste0(tempf,".json")
write(obj, destfile)
validate_features = FALSE
},
"csv" = {
destfile = paste0(tempf,".csv")
lcolnames = tolower(colnames(obj))
if(self$getGeometryType() %in% colnames(obj)){
sf::st_write(obj[,!duplicated(lcolnames)], destfile)
validate_features = FALSE
}else{
readr::write_csv(obj[,!duplicated(lcolnames)], destfile)
read_features = FALSE
Expand Down Expand Up @@ -434,7 +432,7 @@ WFSFeatureType <- R6Class("WFSFeatureType",
}

#validating attributes vs. schema
if(validate_features) for(element in self$description){
if(validate) for(element in self$description){
attrType <- element$getType()
if(!is.null(attrType) && !element$isGeometry()){
attrName = element$getName()
Expand Down
3 changes: 3 additions & 0 deletions man/WFSFeatureType.Rd

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

0 comments on commit fd861f3

Please sign in to comment.