Type: | Package |
Title: | Geographic Information of Uruguay |
Version: | 0.2.8 |
Maintainer: | Richard Detomasi <richard.detomasi@gmail.com> |
Description: | The toolbox have functions to load and process geographic information for Uruguay. And extra-function to get address coordinates and orthophotos through the uruguayan 'IDE' API https://www.gub.uy/infraestructura-datos-espaciales/tramites-y-servicios/servicios/sistema-unico-direcciones-geograficas. |
License: | GPL-3 |
BugReports: | https://github.com/RichDeto/geouy/issues |
Depends: | R (≥ 3.4.0) |
Imports: | assertthat, curl, dplyr, fs, ggplot2, ggspatial, ggthemes, glue, magrittr, methods, raster, rjson, rlang, sf, sp, stringr, tidyselect, utils, viridis |
Suggests: | knitr, rmarkdown, spelling, testthat |
VignetteBuilder: | knitr |
ByteCompile: | true |
Encoding: | UTF-8 |
Language: | en-US |
LazyData: | TRUE |
RoxygenNote: | 7.2.3 |
SystemRequirements: | 'unrar' (Linux/macOS) or '7-Zip' (Windows) to work with '.rar' files, C++11, GDAL (>= 2.0.1), GEOS (>= 3.8.0), PROJ (>= 6.2.1) |
NeedsCompilation: | no |
Packaged: | 2023-08-22 19:22:56 UTC; rdetomasi |
Author: | Richard Detomasi |
Repository: | CRAN |
Date/Publication: | 2023-08-23 15:10:02 UTC |
geouy
package
Description
The toolbox have functions to load and process geographic information for Uruguay.
Details
See the README on Github
Pipe operator
Description
See magrittr::%>%
for details.
Usage
lhs %>% rhs
This function allows you to add a geom variable with a code variable of "zona", "barrio", "localidad", "segmentos", "secciones" or "departamentos".
Description
This function allows you to add a geom variable with a code variable of "zona", "barrio", "localidad", "segmentos", "secciones" or "departamentos".
Usage
add_geom(data, unit, variable, crs = 32721)
Arguments
data |
data.frame |
unit |
spatial unit of data, may be: "Departamentos", "Secciones", "Secc MVD 2004", "Segmentos", "Segm MVD 2004", "Segm URB INT 2004", "Zonas", "Zonas MVD 2004", "Zonas URB INT 2004", "Localidades pg", "Municipios" o "Barrios". |
variable |
Variable name of unit code (without duplicates) |
crs |
Coordinates Refence Sistem, usually in region 32721 or 4326 (default 32721) |
Details
Disclaimer: This script is not an official INE product. Aviso: El script no es un producto oficial de INE.
Value
data.frame
See Also
Other service:
geocode_ide_uy()
,
load_geouy()
,
reverse_ide_uy()
,
tiles_geouy()
,
where_uy()
,
which_uy()
Examples
pobre_x_dpto <- as.data.frame(cbind(nomdpto = c("ARTIGAS", "DURAZNO", "FLORIDA", "LAVALLEJA"),
Pobreza = c(0.26, 0.27, 0.07, 0.10)))
pobre_x_dpto_geo <- add_geom(data = pobre_x_dpto, unit = "Deptos", variable = "nomdpto")
A function to geocoding directions using IDE_uy
Description
A function to geocoding directions using IDE_uy
Usage
geocode_ide_uy(x, details = F)
Arguments
x |
Dataframe with unless 3 variables: dpto = corresponding to the department, loc = city / location, dir = to the address. |
details |
Logical value, default FALSE for X and Y variables only, if TRUE keep all variables of the service. |
Details
https://direcciones.ide.uy/swagger-ui.html#/geocode,_reverse,_inversa
Value
The DafaFrame x with the coordinates variables append (x and y)
See Also
Other service:
add_geom()
,
load_geouy()
,
reverse_ide_uy()
,
tiles_geouy()
,
where_uy()
,
which_uy()
Examples
# x1 <- cbind(dpto="Montevideo",loc="Montevideo",dir="Av. 18 de julio 1453")
# x2 <- data.frame(x1, stringsAsFactors = F)
# geocode_ide_uy(x2)
This function test if an 'sf' object match with Uruguay at crs = 32721.
Description
This function test if an 'sf' object match with Uruguay at crs = 32721.
Usage
is.uy32721(x)
Arguments
x |
An 'sf' object with the same crs as the homonym parameter |
Value
logical value based in crs parameter of the sf object
See Also
Other crs:
is.uy4326()
,
is.uy5381()
,
is.uy5382()
Examples
is.uy32721(load_geouy("Uruguay"))
This function test if an 'sf' object match with Uruguay at crs = 4326.
Description
This function test if an 'sf' object match with Uruguay at crs = 4326.
Usage
is.uy4326(x)
Arguments
x |
An 'sf' object with the same crs as the homonym parameter |
Value
logical value based in crs parameter of the sf object
See Also
Other crs:
is.uy32721()
,
is.uy5381()
,
is.uy5382()
Examples
is.uy4326(load_geouy("Peajes"))
This function test if an 'sf' object match with Uruguay at crs = 5381.
Description
This function test if an 'sf' object match with Uruguay at crs = 5381.
Usage
is.uy5381(x)
Arguments
x |
An 'sf' object with the same crs as the homonym parameter |
Value
logical value based in crs parameter of the sf object
See Also
Other crs:
is.uy32721()
,
is.uy4326()
,
is.uy5382()
Examples
is.uy5381(load_geouy("CCZ"))
This function test if an 'sf' object match with Uruguay at crs = 5382.
Description
This function test if an 'sf' object match with Uruguay at crs = 5382.
Usage
is.uy5382(x)
Arguments
x |
An 'sf' object with the same crs as the homonym parameter |
Value
logical value based in crs parameter of the sf object
See Also
Other crs:
is.uy32721()
,
is.uy4326()
,
is.uy5381()
Examples
is.uy5382(load_geouy("Uruguay"))
This function allows to take oficial uruguayan geometries, as object "sf", from various servers.
Description
This function allows to take oficial uruguayan geometries, as object "sf", from various servers.
Usage
load_geouy(c, crs = 32721, folder = tempdir())
Arguments
c |
Define the geometries to download: may be: "Departamentos", "Secciones", "Zonas", etc. View(metadata) for details. |
crs |
Define the Coordinate Reference Systems you want the output, default 32721 |
folder |
Folder where are the files download if formato == "zip" in metadata. Default tempdir() |
Value
sf object with the requested geometries
See Also
Other service:
add_geom()
,
geocode_ide_uy()
,
reverse_ide_uy()
,
tiles_geouy()
,
where_uy()
,
which_uy()
Examples
secc <- load_geouy(c = "Secciones")
INE "Localidades Agregadas"
Description
A dataset containing the cods, names and others attributes of urban locations for Uruguay.
Usage
loc_agr_ine
Format
A data frame with 615 rows and 8 variables:
- depto
name of the "Departamento"
- nomloc
name of the "Localidad"
- codloc
code of the "Localidad"
- pob2011
Population by "Censo 2011"
- dens2011km
Population density by "Censo 2011" (population/km)
- Nom_loc_agr_13
name of the "Localidades agrupadas" (2013)
- Loc_agr_13
code of the "Localidades agrupadas" (2013)
- cat_loc_agr
Tipical categories of "Localidades"
See Also
Other data:
metadata_tables
,
metadata_wms
,
metadata
,
mvd_barrios_grid
,
uy_deptos_grid
Metadata of geoservices for Uruguay
Description
A dataset containing the urls and other attributes of geoservices for Uruguay.
Usage
metadata
Format
A data frame with 86 rows and 10 variables:
- capa
name of the geoservice
- productor
name of the institution produced the data
- repositor
name of the institution that serves the data
- crs
Coordinate Reference Systems of data
- formato
name of the institution producing the data
- anio
year of data production
- url
url of the service
- cod
name of the variable that contains the cod value of the geometries
- name
name of the variable that contains the name of the geometries
- enc
name of the encoding of the geoservice table
See Also
Other data:
loc_agr_ine
,
metadata_tables
,
metadata_wms
,
mvd_barrios_grid
,
uy_deptos_grid
Metadata of tables for Uruguay
Description
A dataset containing the urls and other attributes of geoservices for Uruguay.
Usage
metadata_tables
Format
A data frame with 3 rows and 3 variables:
- tabla
name of the geoservice
- formato
name of the institution producing the data
- url
url of the service
See Also
Other data:
loc_agr_ine
,
metadata_wms
,
metadata
,
mvd_barrios_grid
,
uy_deptos_grid
Metadata of WMS for Uruguay
Description
A dataset containing the urls and other attributes of geoservices for Uruguay.
Usage
metadata_wms
Format
A data frame with 7 rows and 3 variables:
- capa
name of the geoservice
- formato
name of the institution producing the data
- url
url of the service
See Also
Other data:
loc_agr_ine
,
metadata_tables
,
metadata
,
mvd_barrios_grid
,
uy_deptos_grid
Montevideo barrios grid
Description
A dataset containing the cods, names and others attributes as a geofacet grid
Usage
mvd_barrios_grid
Format
A data frame with 62 rows and 4 variables:
- name
name of the "Barrio"
- code
INE code of the "Barrio"
- row
row position in the grid
- col
col position in the grid
See Also
Other data:
loc_agr_ine
,
metadata_tables
,
metadata_wms
,
metadata
,
uy_deptos_grid
plot_geouy
Description
This function allows you to set ggplot2 theme in our suggested format.
Usage
plot_geouy(x, col, viri_opt = "plasma", l = NULL, other_lab = NULL, ...)
Arguments
x |
An sf object like load_geouy() results |
col |
Variable of "x" to plot (character) |
viri_opt |
A character string indicating the colormap option to use. Four options are available: "magma" (or "A"), "inferno" (or "B"), "plasma" (or "C"), "viridis" (or "D", the default option) and "cividis" (or "E") |
l |
If NULL none label added, if "%" porcentage with 1 decimal labels, if "n" the value is the label, if "c" put other variable in other_lab. Default NULL |
other_lab |
If l is "c" put here the variable name for the labels. |
... |
All parameters allowed from ggplot2 themes. |
Value
ggplot object of a choropleth map with x geometries and col values.
Examples
secc <- load_geouy("Secciones")
plot_geouy(x = secc, col = "AREA")
A function to reverse geocoding from coordinates (EPSG 4326) using IDE_uy
Description
A function to reverse geocoding from coordinates (EPSG 4326) using IDE_uy
Usage
reverse_ide_uy(x, details = F)
Arguments
x |
Dataframe with unless 2 variables: lat = latitud in EPSG:4326 & longitud in EPSG:4326. |
details |
Logical value, default FALSE for X and Y variables only, if TRUE keep all variables of the service. |
Details
https://direcciones.ide.uy/swagger-ui.html#/Geocode
Value
The DafaFrame x with the direction variables append (address, nomVia, tip_via, portalNumber, letra, postalCode, localidad, departamento, manzana, solar and km)
See Also
Other service:
add_geom()
,
geocode_ide_uy()
,
load_geouy()
,
tiles_geouy()
,
where_uy()
,
which_uy()
Examples
# x <- data.frame(cbind(lat = -34.77882, lon = -56.06476))
# reverse_ide_uy(x)
This function allows to Download .jpg or .tif files from the IDEuy tiles repository, according to a 'sf' object bbox.
Description
This function allows to Download .jpg or .tif files from the IDEuy tiles repository, according to a 'sf' object bbox.
Usage
tiles_geouy(x, d = NA, format = "rgb", folder = tempdir(), urban = FALSE)
Arguments
x |
An 'sf' object with the same crs as the homonym parameter |
d |
numeric; buffer distance for all, or for each of the elements in x; in case dist is a units object, it should be convertible to arc_degree if x has geographic coordinates, and to st_crs(x)$units otherwise. Default NA, but if x is a only one point buffer default is 100. |
format |
Format of the archives to download (avaiable: "rgb" and "rgbi") Default "rgb" |
folder |
Folder where are the files or be download |
urban |
logical; If FALSE take orthophotos of national flight with 32cm per pixel, if TRUE take urban flight with 10cm per pixel (avaible only Montevideo at the moment) |
Value
raster::stack object with th cropped tif corresponding to x bbox
See Also
Other service:
add_geom()
,
geocode_ide_uy()
,
load_geouy()
,
reverse_ide_uy()
,
where_uy()
,
which_uy()
Examples
x <- data.frame(x = 577968, y = 6147753, id = 1)
x <- sf::st_as_sf(x, coords = c("x", "y"), crs = 32721)
x_tiles <- tiles_geouy(x, urban = TRUE)
Uruguay Departments grid
Description
A dataset containing the cods, names and others attributes as a geofacet grid
Usage
uy_deptos_grid
Format
A data frame with 19 rows and 4 variables:
- name
name of the "Departamento"
- code
INE code of the "Departamento"
- row
row position in the grid
- col
col position in the grid
See Also
Other data:
loc_agr_ine
,
metadata_tables
,
metadata_wms
,
metadata
,
mvd_barrios_grid
This function return an 'sf' object with the geometry of the consult id or group of ids, of an administrative units in Uruguay.
Description
This function return an 'sf' object with the geometry of the consult id or group of ids, of an administrative units in Uruguay.
Usage
where_uy(c = "Localidades pg", d = "cod", e, crs = 32721)
Arguments
c |
Define the geometries to consult: may be: "Departamentos", "Secciones", "Zonas", etc. View(metadata) for details. |
d |
A vector who determines the variables to be consult, with two options: "cod" or "name". Default "cod". |
e |
A vector who determines the ids or names to identify. |
crs |
Define the Coordinate Reference Systems you want the output, default 32721 |
Value
sf object with the geometries of the d ids
See Also
Other service:
add_geom()
,
geocode_ide_uy()
,
load_geouy()
,
reverse_ide_uy()
,
tiles_geouy()
,
which_uy()
Examples
x <- where_uy(c = "Localidades pg", d = "cod", e = c(1120, 2220))
This function allows to add to an 'sf' object its spatial coincidence with one or more administrative units in Uruguay, generating the corresponding variables.
Description
This function allows to add to an 'sf' object its spatial coincidence with one or more administrative units in Uruguay, generating the corresponding variables.
Usage
which_uy(x, c = c("Localidades pg", "Departamentos"), d = c("cod", "name"))
Arguments
x |
An 'sf' object with the same crs as the homonym parameter |
c |
Define the geometries to download: may be: "Departamentos", "Secciones", "Zonas", etc. View(metadata) for details. |
d |
A vector who determines the variables to be added, with three options: "cod", "name", or "full". Default c("cod", "name"). |
Value
sf object with the x geometries, with d variables requested from c added
See Also
Other service:
add_geom()
,
geocode_ide_uy()
,
load_geouy()
,
reverse_ide_uy()
,
tiles_geouy()
,
where_uy()
Examples
x <- load_geouy("Peajes")
x1 <- which_uy(x, c = "Deptos")