Skip to content

Commit

Permalink
fix #109
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Jul 12, 2023
1 parent 164b518 commit 5daee68
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ows4R
Version: 0.3-5
Date: 2023-04-12
Version: 0.4
Date: 2023-07-12
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
18 changes: 16 additions & 2 deletions R/WFSFeatureType.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ WFSFeatureType <- R6Class("WFSFeatureType",
defaultCRS = NA,
WGS84BoundingBox = NA,

supportedGeomPossibleNames = c("the_geom", "geom", "wkt", "geom_wkt", "wkb", "geom_wkb"),
supportedXPossibleNames = c("x","lon","long","longitude","decimalLongitude"),
supportedYPossibleNames = c("y","lat","lati","latitude","decimalLatitude"),

#fetchFeatureType
fetchFeatureType = function(xmlObj, version){

Expand Down Expand Up @@ -373,13 +377,23 @@ WFSFeatureType <- R6Class("WFSFeatureType",
},
"csv" = {
destfile = paste0(tempf,".csv")
sf::st_write(obj, destfile)
lcolnames = tolower(colnames(obj))
sf::st_write(obj[,!duplicated(lcolnames)], destfile)
}
)
}

#read features
ftFeatures <- sf::st_read(destfile, quiet = TRUE)
ftFeatures <- switch(tolower(outputFormat),
"csv" = sf::st_read(destfile, quiet = TRUE,
options = c(
sprintf("GEOM_POSSIBLE_NAMES=%s", paste0(private$supportedGeomPossibleNames, collapse=",")),
sprintf("X_POSSIBLE_NAMES=%s", paste0(private$supportedXPossibleNames, collapse=",")),
sprintf("Y_POSSIBLE_NAMES=%s", paste0(private$supportedYPossibleNames, collapse=","))
)
),
sf::st_read(destfile, quiet = TRUE)
)
if(self$hasGeometry()){
if(is.na(st_crs(ftFeatures))) st_crs(ftFeatures) <- self$getFeaturesCRS(obj)
if(is.na(st_crs(ftFeatures))) st_crs(ftFeatures) <- self$getDefaultCRS()
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![Build Status](https://github.com/eblondel/ows4R/actions/workflows/r-cmd-check.yml/badge.svg?branch=master)](https://github.com/eblondel/ows4R/actions/workflows/r-cmd-check.yml)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/ows4R)](https://cran.r-project.org/package=ows4R)
[![cran checks](https://badges.cranchecks.info/worst/ows4R.svg)](https://cran.r-project.org/web/checks/check_results_ows4R.html)
[![Github_Status_Badge](https://img.shields.io/badge/Github-0.3--5-blue.svg)](https://github.com/eblondel/ows4R)
[![Github_Status_Badge](https://img.shields.io/badge/Github-0.4-blue.svg)](https://github.com/eblondel/ows4R)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1345111.svg)](https://doi.org/10.5281/zenodo.1345111)

**ows4R – R Interface to OGC Web-Services (OWS)**
Expand Down

0 comments on commit 5daee68

Please sign in to comment.