Skip to content

Commit

Permalink
v0.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
RichDeto committed May 27, 2021
1 parent bcb6ed4 commit 49eee69
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 93 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
## geouy v0.2.5 (In progress)

* Add demographic links from IDEuy
* Add an encoding variable to metadata.
* Implementation of encoding definition to load_geouy()


## geouy v0.2.4 (2021-05-02)
Expand Down
3 changes: 2 additions & 1 deletion R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' A dataset containing the urls and other attributes of geoservices
#' for Uruguay.
#' @family data
#' @format A data frame with 59 rows and 9 variables:
#' @format A data frame with 59 rows and 10 variables:
#' \describe{
#' \item{capa}{name of the geoservice}
#' \item{productor}{name of the institution produced the data}
Expand All @@ -14,6 +14,7 @@
#' \item{url}{url of the service}
#' \item{cod}{name of the variable that contains the cod value of the geometries}
#' \item{name}{name of the variable that contains the name of the geometries}
#' \item{enc}{name of the encoding of the geoservice table}
#' }
"metadata"

Expand Down
13 changes: 11 additions & 2 deletions R/load_geouy.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ load_geouy <- function(c, crs = 32721, folder = tempdir()){
try(if (!c %in% x$capa) stop("The name of the geometry you will load is not correct. Verify in the metadata file"))
if (!curl::has_internet()) stop("No internet access detected. Please check your connection.")
x <- x[x$capa == c,]
enco <- x$enc
if (x$repositor %in% "SGM") {
a <- sf::st_read("WFS:http://geoservicios.sgm.gub.uy/wfsPCN1000.cgi?",x$url, crs = x$crs)
} else if (x$formato %in% c("zip", "zip a")) {
Expand All @@ -43,9 +44,17 @@ load_geouy <- function(c, crs = 32721, folder = tempdir()){
#archive_extract(archive.path = f, dest.path = )))
archivo <- fs::dir_ls(folder, regexp = "\\.shp$")
archivo <- archivo[which.max(file.info(archivo)$mtime)]
a <- sf::st_read(archivo, crs = x$crs)
if(!enco == "UTF-8"){
a <- sf::st_read(archivo, crs = x$crs, options = glue::glue("ENCODING=", enco))
} else {
a <- sf::st_read(archivo, crs = x$crs)
}
} else {
a <- sf::st_read(x$url, crs = x$crs)
if(!enco == "UTF-8"){
a <- sf::st_read(x$url, crs = x$crs, options = glue::glue("ENCODING=", enco))
} else {
a <- sf::st_read(x$url, crs = x$crs)
}
}
a <- a %>% sf::st_transform(crs)
return(a)
Expand Down
178 changes: 89 additions & 89 deletions data-raw/metadata.R

Large diffs are not rendered by default.

Binary file modified data-raw/metadata.Rds
Binary file not shown.
Binary file modified data/metadata.rda
Binary file not shown.
3 changes: 2 additions & 1 deletion man/metadata.Rd

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

0 comments on commit 49eee69

Please sign in to comment.