Title: | Geographic Information of Uruguay |
---|---|
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>. |
Authors: | Richard Detomasi [aut, cre, cph] , Ministerio de Desarrollo Social, Uruguay (MIDES) [dtc], Infraestrutura de Datos Espaciales, Uruguay (IDE) [dtc], Servicio Geográfico Militar, Uruguay (SGM) [dtc], Ministerio de Transporte y Obras Públicas, Uruguay (MTOP) [dtc], Instituto Nacional de Estadística, Uruguay (INE) [dtc], Instituto Geográfico Militar, Uruguay (IGM) [dtc], Ministerio de Vivienda, Ordenamiento Territorial y Medio Ambiente, Uruguay (MVOTMA) [dtc] |
Maintainer: | Richard Detomasi <[email protected]> |
License: | GPL-3 |
Version: | 0.2.8 |
Built: | 2024-11-06 04:59:06 UTC |
Source: | https://github.com/richdeto/geouy |
This function allows you to add a geom variable with a code variable of "zona", "barrio", "localidad", "segmentos", "secciones" or "departamentos".
add_geom(data, unit, variable, crs = 32721)
add_geom(data, unit, variable, crs = 32721)
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) |
Disclaimer: This script is not an official INE product. Aviso: El script no es un producto oficial de INE.
data.frame
Other service:
geocode_ide_uy()
,
load_geouy()
,
reverse_ide_uy()
,
tiles_geouy()
,
where_uy()
,
which_uy()
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")
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
geocode_ide_uy(x, details = F)
geocode_ide_uy(x, details = F)
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. |
https://direcciones.ide.uy/swagger-ui.html#/geocode,_reverse,_inversa
The DafaFrame x with the coordinates variables append (x and y)
Other service:
add_geom()
,
load_geouy()
,
reverse_ide_uy()
,
tiles_geouy()
,
where_uy()
,
which_uy()
# x1 <- cbind(dpto="Montevideo",loc="Montevideo",dir="Av. 18 de julio 1453") # x2 <- data.frame(x1, stringsAsFactors = F) # geocode_ide_uy(x2)
# x1 <- cbind(dpto="Montevideo",loc="Montevideo",dir="Av. 18 de julio 1453") # x2 <- data.frame(x1, stringsAsFactors = F) # geocode_ide_uy(x2)
geouy
packageThe toolbox have functions to load and process geographic information for Uruguay.
See the README on Github
This function test if an 'sf' object match with Uruguay at crs = 32721.
is.uy32721(x)
is.uy32721(x)
x |
An 'sf' object with the same crs as the homonym parameter |
logical value based in crs parameter of the sf object
Other crs:
is.uy4326()
,
is.uy5381()
,
is.uy5382()
is.uy32721(load_geouy("Uruguay"))
is.uy32721(load_geouy("Uruguay"))
This function test if an 'sf' object match with Uruguay at crs = 4326.
is.uy4326(x)
is.uy4326(x)
x |
An 'sf' object with the same crs as the homonym parameter |
logical value based in crs parameter of the sf object
Other crs:
is.uy32721()
,
is.uy5381()
,
is.uy5382()
is.uy4326(load_geouy("Peajes"))
is.uy4326(load_geouy("Peajes"))
This function test if an 'sf' object match with Uruguay at crs = 5381.
is.uy5381(x)
is.uy5381(x)
x |
An 'sf' object with the same crs as the homonym parameter |
logical value based in crs parameter of the sf object
Other crs:
is.uy32721()
,
is.uy4326()
,
is.uy5382()
is.uy5381(load_geouy("CCZ"))
is.uy5381(load_geouy("CCZ"))
This function test if an 'sf' object match with Uruguay at crs = 5382.
is.uy5382(x)
is.uy5382(x)
x |
An 'sf' object with the same crs as the homonym parameter |
logical value based in crs parameter of the sf object
Other crs:
is.uy32721()
,
is.uy4326()
,
is.uy5381()
is.uy5382(load_geouy("Uruguay"))
is.uy5382(load_geouy("Uruguay"))
This function allows to take oficial uruguayan geometries, as object "sf", from various servers.
load_geouy(c, crs = 32721, folder = tempdir())
load_geouy(c, crs = 32721, folder = tempdir())
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() |
sf object with the requested geometries
Other service:
add_geom()
,
geocode_ide_uy()
,
reverse_ide_uy()
,
tiles_geouy()
,
where_uy()
,
which_uy()
secc <- load_geouy(c = "Secciones")
secc <- load_geouy(c = "Secciones")
A dataset containing the cods, names and others attributes of urban locations for Uruguay.
loc_agr_ine
loc_agr_ine
A data frame with 615 rows and 8 variables:
name of the "Departamento"
name of the "Localidad"
code of the "Localidad"
Population by "Censo 2011"
Population density by "Censo 2011" (population/km)
name of the "Localidades agrupadas" (2013)
code of the "Localidades agrupadas" (2013)
Tipical categories of "Localidades"
Other data:
metadata_tables
,
metadata_wms
,
metadata
,
mvd_barrios_grid
,
uy_deptos_grid
A dataset containing the urls and other attributes of geoservices for Uruguay.
metadata
metadata
A data frame with 86 rows and 10 variables:
name of the geoservice
name of the institution produced the data
name of the institution that serves the data
Coordinate Reference Systems of data
name of the institution producing the data
year of data production
url of the service
name of the variable that contains the cod value of the geometries
name of the variable that contains the name of the geometries
name of the encoding of the geoservice table
Other data:
loc_agr_ine
,
metadata_tables
,
metadata_wms
,
mvd_barrios_grid
,
uy_deptos_grid
A dataset containing the urls and other attributes of geoservices for Uruguay.
metadata_tables
metadata_tables
A data frame with 3 rows and 3 variables:
name of the geoservice
name of the institution producing the data
url of the service
Other data:
loc_agr_ine
,
metadata_wms
,
metadata
,
mvd_barrios_grid
,
uy_deptos_grid
A dataset containing the urls and other attributes of geoservices for Uruguay.
metadata_wms
metadata_wms
A data frame with 7 rows and 3 variables:
name of the geoservice
name of the institution producing the data
url of the service
Other data:
loc_agr_ine
,
metadata_tables
,
metadata
,
mvd_barrios_grid
,
uy_deptos_grid
A dataset containing the cods, names and others attributes as a geofacet grid
mvd_barrios_grid
mvd_barrios_grid
A data frame with 62 rows and 4 variables:
name of the "Barrio"
INE code of the "Barrio"
row position in the grid
col position in the grid
Other data:
loc_agr_ine
,
metadata_tables
,
metadata_wms
,
metadata
,
uy_deptos_grid
This function allows you to set ggplot2 theme in our suggested format.
plot_geouy(x, col, viri_opt = "plasma", l = NULL, other_lab = NULL, ...)
plot_geouy(x, col, viri_opt = "plasma", l = NULL, other_lab = NULL, ...)
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. |
ggplot object of a choropleth map with x geometries and col values.
secc <- load_geouy("Secciones") plot_geouy(x = secc, col = "AREA")
secc <- load_geouy("Secciones") plot_geouy(x = secc, col = "AREA")
A function to reverse geocoding from coordinates (EPSG 4326) using IDE_uy
reverse_ide_uy(x, details = F)
reverse_ide_uy(x, details = F)
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. |
https://direcciones.ide.uy/swagger-ui.html#/Geocode
The DafaFrame x with the direction variables append (address, nomVia, tip_via, portalNumber, letra, postalCode, localidad, departamento, manzana, solar and km)
Other service:
add_geom()
,
geocode_ide_uy()
,
load_geouy()
,
tiles_geouy()
,
where_uy()
,
which_uy()
# x <- data.frame(cbind(lat = -34.77882, lon = -56.06476)) # reverse_ide_uy(x)
# 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.
tiles_geouy(x, d = NA, format = "rgb", folder = tempdir(), urban = FALSE)
tiles_geouy(x, d = NA, format = "rgb", folder = tempdir(), urban = FALSE)
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) |
raster::stack object with th cropped tif corresponding to x bbox
Other service:
add_geom()
,
geocode_ide_uy()
,
load_geouy()
,
reverse_ide_uy()
,
where_uy()
,
which_uy()
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)
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)
A dataset containing the cods, names and others attributes as a geofacet grid
uy_deptos_grid
uy_deptos_grid
A data frame with 19 rows and 4 variables:
name of the "Departamento"
INE code of the "Departamento"
row position in the grid
col position in the grid
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.
where_uy(c = "Localidades pg", d = "cod", e, crs = 32721)
where_uy(c = "Localidades pg", d = "cod", e, crs = 32721)
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 |
sf object with the geometries of the d ids
Other service:
add_geom()
,
geocode_ide_uy()
,
load_geouy()
,
reverse_ide_uy()
,
tiles_geouy()
,
which_uy()
x <- where_uy(c = "Localidades pg", d = "cod", e = c(1120, 2220))
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.
which_uy(x, c = c("Localidades pg", "Departamentos"), d = c("cod", "name"))
which_uy(x, c = c("Localidades pg", "Departamentos"), d = c("cod", "name"))
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"). |
sf object with the x geometries, with d variables requested from c added
Other service:
add_geom()
,
geocode_ide_uy()
,
load_geouy()
,
reverse_ide_uy()
,
tiles_geouy()
,
where_uy()
x <- load_geouy("Peajes") x1 <- which_uy(x, c = "Deptos")
x <- load_geouy("Peajes") x1 <- which_uy(x, c = "Deptos")