Package 'rgeomex'

Title: Geographic Boundaries of Mexico from INEGI and INE
Description: Geographic boundaries of Mexico (states, municipalities, localities, AGEB, blocks and electoral sections) from INEGI 2019 and INE 2020, and functions to extract the AGEB, blocks and electoral sections of a locality.
Authors: Felipe Antonio Dzul Manzanilla [aut, cre] (ORCID: <https://orcid.org/0000-0002-2085-9141>), Fabián Correa-Morales [aut] (ORCID: <https://orcid.org/0000-0002-6193-1242>), Emmanuel Morales García [aut] (ORCID: <https://orcid.org/0000-0002-6837-9227>), Cecilia Cruz López [aut] (ORCID: <https://orcid.org/0000-0002-9156-5669>), Héctor Gómez-Dantés [aut] (ORCID: <https://orcid.org/0000-0002-2025-3641>)
Maintainer: Felipe Antonio Dzul Manzanilla <[email protected]>
License: MIT + file LICENSE
Version: 0.2.0
Built: 2026-11-22 14:09:59 UTC
Source: https://github.com/fdzul/rgeomex

Help Index


Polygons of AGEBs from México of the National Institute of Geography and Statistics 2019

Description

A spatial dataset containing of polygon data of AGEBs from México

Usage

AGEB_inegi_2019_a

Format

A sf object with 80202 rows and 10 variables:

OBJECTID

the ids.

CVEGEO

the string key. The key included the CVE_ENT, CVE_MUN, CVE_LOC and CVE_AGEB

CVE_ENT

is the string key for each state.

CVE_MUN

is the string key to the Municipality.

CVE_LOC

is string the key of locality.

CVE_AGEB

is the string key of AGEB.

Ambito

is a binary variable with two values, Urbana and Rural. The dataset is inly AGEB Urban

Shape_Leng

is the length of polygon

geometry

simple feature.

...

Details

AGEB (Areas GeoEstadisticas Basicas) is stand for basic geostatistical areas. This datasets were published in september 2019.

Note

Downloaded from the GeoParquet release of rgeomex-py the first time it is used; see rgeomex_load().

Source

https://www.inegi.org.mx/temas/mg/#Descargas


Polygons of AGEBs from México of the National Institute of Geography and Statistics 2019

Description

A spatial dataset containing of polygon data of AGEBs from México

Usage

AGEB_inegi_2019_b

Format

A sf object with 80202 rows and 10 variables:

OBJECTID

the ids.

CVEGEO

the string key. The key included the CVE_ENT, CVE_MUN, CVE_LOC and CVE_AGEB

CVE_ENT

is the string key for each state.

CVE_MUN

is the string key to the Municipality.

CVE_LOC

is string the key of locality.

CVE_AGEB

is the string key of AGEB.

Ambito

is a binary variable with two values, Urbana and Rural. The dataset is inly AGEB Urban

Shape_Leng

is the length of polygon

geometry

simple feature.

...

Details

AGEB (Areas GeoEstadisticas Basicas) is stand for basic geostatistical areas. This datasets were published in september 2019.

Note

Downloaded from the GeoParquet release of rgeomex-py the first time it is used; see rgeomex_load().

Source

https://www.inegi.org.mx/temas/mg/#Descargas


Polygons of AGEEs from México of the National Institute of Geography and Statistics 2019 A spatial dataset containing of polygon data of AGEE from México

Description

Polygons of AGEEs from México of the National Institute of Geography and Statistics 2019 A spatial dataset containing of polygon data of AGEE from México

Usage

AGEE_inegi19_mx

Format

A sf object with 32 rows and 4 variables:

CVEGEO

the numeric key. The key included the CVE_ENT.

CVE_ENT

is the numeric key for each state.

NOMGEO

is a string value. Its the name of state.

geometry

simple feature.

...

Details

AGEE (Areas GeoEstadisticas Estatales) is stand for State Geostatistical Areas. This datasets were published in september 2019.

Note

Downloaded from the GeoParquet release of rgeomex-py the first time it is used; see rgeomex_load().

Source

https://www.inegi.org.mx/temas/mg/#Descargas


Polygons of AGEMs from México of the National Institute of Geography and Statistics 2019 A spatial dataset containing of polygon data of AGEM from México

Description

Polygons of AGEMs from México of the National Institute of Geography and Statistics 2019 A spatial dataset containing of polygon data of AGEM from México

Usage

AGEM_inegi19_mx

Format

A sf object with 2465 rows and 5 variables:

CVEGEO

the numeric key. The key included the CVE_ENT and the CVE_MUN.

CVE_ENT

is the numeric key for each state.

CVE_MUN

is the string key to the Municipality.

NOMGEO

is a string value. Its the name of municipality.

geometry

simple feature.

...

Details

AGEM (Areas GeoEstadisticas Municipales) is stand for Municipality Geostatistical Areas. This datasets were update 2025.

Note

Downloaded from the GeoParquet release of rgeomex-py the first time it is used; see rgeomex_load().

Source

https://www.inegi.org.mx/temas/mg/#Descargas


Polygons of AGEMs from México of the National Institute of Geography and Statistics 2025 A spatial dataset containing of polygon data of AGEM from México

Description

Polygons of AGEMs from México of the National Institute of Geography and Statistics 2025 A spatial dataset containing of polygon data of AGEM from México

Usage

AGEM_inegi25_mx

Format

A sf object with 2478 rows and 5 variables:

CVEGEO

the numeric key. The key included the CVE_ENT and the CVE_MUN.

CVE_ENT

is the numeric key for each state.

CVE_MUN

is the string key to the Municipality.

NOMGEO

is a string value. Its the name of municipality.

geometry

simple feature.

...

Details

AGEM (Areas GeoEstadisticas Municipales) is stand for Municipality Geostatistical Areas.

Note

Downloaded from the GeoParquet release of rgeomex-py the first time it is used; see rgeomex_load().

Source

https://www.inegi.org.mx/temas/mg/#Descargas


Polygons of blocks from Mexico of the National Electoral Institute 2020

Description

A spatial dataset containing of polygon data of blocks from Mexico

Usage

blocks_ine20_mx_a

Format

A sf object with 2278337 rows and 19 variables:

gid

the ids.

id

the ids.

entidad

is the numeric key of state.

distrito

is the numeric key of federal district.

municipio

is the numeric key to the Municipality

seccion

is the numeric key to the Sectors

localidad

is numeric the key of locality

manzana

is the numeric key of blocks

geometry

simple feature.

...

Details

This datasets were published in october 2020.

Note

Downloaded from the GeoParquet release of rgeomex-py the first time it is used; see rgeomex_load().

Source

https://pautas.ine.mx/transparencia/mapas/


Polygons of blocks from México of the National Electoral Institute 2020

Description

A spatial dataset containing of polygon data of blocks from México

Usage

blocks_ine20_mx_b

Format

A sf object with 2278337 rows and 19 variables:

gid

the ids.

id

the ids.

entidad

is the numeric key of state.

distrito

is the numeric key of federal district.

municipio

is the numeric key to the Municipality

seccion

is the numeric key to the Sectors

localidad

is numeric the key of locality

manzana

is the numeric key of blocks

geometry

simple feature.

...

Details

This datasets were published in october 2020.

Note

Downloaded from the GeoParquet release of rgeomex-py the first time it is used; see rgeomex_load().

Source

https://pautas.ine.mx/transparencia/mapas/


Polygons of blocks from México of the National Electoral Institute 2020

Description

A spatial dataset containing of polygon data of blocks from México

Usage

blocks_ine20_mx_c

Format

A sf object with 2278337 rows and 19 variables:

gid

the ids.

id

the ids.

entidad

is the numeric key of state.

distrito

is the numeric key of federal district.

municipio

is the numeric key to the Municipality

seccion

is the numeric key to the Sectors

localidad

is numeric the key of locality

manzana

is the numeric key of blocks

geometry

simple feature.

...

Details

This datasets were published in october 2020.

Note

Downloaded from the GeoParquet release of rgeomex-py the first time it is used; see rgeomex_load().

Source

https://pautas.ine.mx/transparencia/mapas/


Blocks centroids from México of the National Electoral Institute 2020 A dataset containing of centroid data of blocks from México

Description

Blocks centroids from México of the National Electoral Institute 2020 A dataset containing of centroid data of blocks from México

Usage

blocks_ine20_mx_centroid

Format

A dataframe with 1556070 rows and 4 variables:

cve_ent

the numeric key state

cve_geo

is the numeric key for each block centroid.The key included the key of state, municipality, locality, sector and blocks.

x

is the longitude

y

is the latitude

...

Note

Downloaded from the GeoParquet release of rgeomex-py the first time it is used; see rgeomex_load().

Source

INE


Polygons of blocks from México of the National Electoral Institute 2020

Description

A spatial dataset containing of polygon data of blocks from México

Usage

blocks_ine20_mx_d

Format

A sf object with 2278337 rows and 19 variables:

gid

the ids.

id

the ids.

entidad

is the numeric key of state.

distrito

is the numeric key of federal district.

municipio

is the numeric key to the Municipality

seccion

is the numeric key to the Sectors

localidad

is numeric the key of locality

manzana

is the numeric key of blocks

geometry

simple feature.

...

Details

This datasets were published in october 2020.

Note

Downloaded from the GeoParquet release of rgeomex-py the first time it is used; see rgeomex_load().

Source

https://pautas.ine.mx/transparencia/mapas/


Polygons of blocks from México of the National Electoral Institute 2020

Description

A spatial dataset containing of polygon data of blocks from México

Usage

blocks_ine20_mx_e

Format

A sf object with 2278337 rows and 19 variables:

gid

the ids.

id

the ids.

entidad

is the numeric key of state.

distrito

is the numeric key of federal district.

municipio

is the numeric key to the Municipality

seccion

is the numeric key to the Sectors

localidad

is numeric the key of locality

manzana

is the numeric key of blocks

geometry

simple feature.

...

Details

This datasets were published in october 2020.

Note

Downloaded from the GeoParquet release of rgeomex-py the first time it is used; see rgeomex_load().

Source

https://pautas.ine.mx/transparencia/mapas/


Extract the AGEB of one or several localities

Description

Extracts the urban AGEB (INEGI 2019) that intersect the boundary of one or several localities.

Usage

extract_ageb(locality, cve_edo)

Arguments

locality

name of the locality (INEGI 2019), or a vector of names for several localities, e.g. a metropolitan area. The most similar name is used, so accents and capital letters do not matter. For Mexico City (cve_edo = "09") the whole city is returned.

cve_edo

INEGI key of the state, from "01" to "32".

Value

a list with two sf objects: locality (the boundary of the localities) and ageb (its AGEB).

Author(s)

Felipe Antonio Dzul Manzanilla [email protected].

Examples

x <- extract_ageb(cve_edo = "31", locality = "Merida")
plot(sf::st_geometry(x$ageb))

# several localities: metropolitan area of Guadalajara
gdl <- extract_ageb(cve_edo = "14",
    locality = c("Guadalajara", "Zapopan", "Tonala", "Tlaquepaque"))

Extract the blocks of one or several localities

Description

Extracts the blocks (manzanas, INE 2020) that intersect the boundary of one or several localities.

Usage

extract_blocks(locality, cve_edo)

Arguments

locality

name of the locality (INEGI 2019), or a vector of names for several localities, e.g. a metropolitan area. The most similar name is used, so accents and capital letters do not matter. For Mexico City (cve_edo = "09") the whole city is returned.

cve_edo

INEGI key of the state, from "01" to "32".

Value

a list with two sf objects: locality (the boundary of the localities) and block (its blocks).

Author(s)

Felipe Antonio Dzul Manzanilla [email protected].

Examples

x <- extract_blocks(cve_edo = "31", locality = "Merida")
plot(sf::st_geometry(x$block))

# several localities: metropolitan area of Guadalajara
gdl <- extract_blocks(cve_edo = "14",
    locality = c("Guadalajara", "Zapopan", "Tonala", "Tlaquepaque"))

Extract the boundary of one or several localities

Description

Extract the boundary of one or several localities

Usage

extract_locality(cve_edo, locality)

Arguments

cve_edo

INEGI key of the state, from "01" to "32".

locality

name of the locality (INEGI 2019), or a vector of names for several localities, e.g. a metropolitan area. The most similar name is used, so accents and capital letters do not matter. For Mexico City (cve_edo = "09") the whole city is returned.

Value

a sf object with the boundary of the locality (one row per locality).

Author(s)

Felipe Antonio Dzul Manzanilla [email protected].

Examples

merida <- extract_locality(cve_edo = "31", locality = "Merida")

# metropolitan area of Guadalajara
gdl <- extract_locality(cve_edo = "14",
                        locality = c("Guadalajara", "Zapopan",
                                     "Tonala", "Tlaquepaque"))

Extract the electoral sections of one or several localities

Description

Extracts the electoral sections (secciones, INE 2020) that intersect the boundary of one or several localities.

Usage

extract_sectores(locality, cve_edo)

Arguments

locality

name of the locality (INEGI 2019), or a vector of names for several localities, e.g. a metropolitan area. The most similar name is used, so accents and capital letters do not matter. For Mexico City (cve_edo = "09") the whole city is returned.

cve_edo

INEGI key of the state, from "01" to "32".

Value

a list with two sf objects: locality (the boundary of the localities) and sectores (its sections).

Author(s)

Felipe Antonio Dzul Manzanilla [email protected].

Examples

x <- extract_sectores(cve_edo = "31", locality = "Merida")
plot(sf::st_geometry(x$sectores))

# several localities: metropolitan area of Guadalajara
gdl <- extract_sectores(cve_edo = "14",
    locality = c("Guadalajara", "Zapopan", "Tonala", "Tlaquepaque"))

find_most_similar_string

Description

Returns a vector of most similar string in another vector. Returns a vector of the same length as input vector '.s'.

Usage

find_most_similar_string(
  .s,
  .t,
  max_dist = Inf,
  verbose = TRUE,
  ignore_case = TRUE,
  feeling_lucky = FALSE,
  ...
)

Arguments

.s

a character vector to be matched.

.t

a character vector to be matched against.

max_dist

the maximum string distance

verbose

should warnings be printed in the console.

ignore_case

should case be ignored? Default is TRUE.

feeling_lucky

if multiple most similar strings are found. Should the first one be returned?

...

other arguments passed to utils::adist.

Details

Uses the generalized Levenshtein distance. For more information type ?utils::adist in the console. the original source is https://github.com/davidsjoberg/similiars/blob/master/R/similiars.R

Value

a character vector

Examples

find_most_similar_string("merida", c("Merida", "Mexicali", "Monterrey"))

hrl_mx

Description

High risk localities of Mexico

Usage

hrl_mx

Format

A sf object with 150 rows and 8 variables:

cvegeo

the ids.

loc

name of the localitie

ambito

type of localities

geometry

geometry column

...

Details

This database was built using the SIMN annual goals dataset

Note

Downloaded from the GeoParquet release of rgeomex-py the first time it is used; see rgeomex_load().

Source

https://geosis.mx/Aplicaciones/EntomologiayControl/Home/IndexNacional


Iter 2020

Description

A spatial dataset containing of the National Institute of Geography and Statistics INEGI ITER 2020

Usage

iter_2020_loc

Format

A sf object with 189432 rows and 10 variables:

entidad

the ids.

nom_ent

the ids.

mun

is the numeric key of state.

nom_mun

is the numeric key of federal district.

nom_loc

is the numeric key of federal district.

loc

is the numeric key to the Municipality

longitud

is the numeric key to the Sectors

latitud

is numeric the key of tipo

altitud

is the simple feature

pobtot

...

Details

This datasets were published in July 26 2021.

Note

Downloaded from the GeoParquet release of rgeomex-py the first time it is used; see rgeomex_load().

Source

https://www.inegi.org.mx/programas/ccpv/2020/#datos_abiertos


Polygons of localities from México of the National Institute of Geography and Statistics 2019 A spatial dataset containing of polygon data of localities from México

Description

Polygons of localities from México of the National Institute of Geography and Statistics 2019 A spatial dataset containing of polygon data of localities from México

Usage

loc_inegi19_mx

Format

A sf object with 49981 rows and 7 variables:

CVEGEO

the numeric key. The key included the CVE_ENT and the CVE_MUN.

CVE_ENT

is the numeric key for each state.

CVE_MUN

is the string key to the Municipality.

CVE_LOC

is the string key of locality.

NOMGEO

is a string value. Its the name of locality.

Ambito

is a binary variable with two values, Urbana and Rural.

geometry

simple feature.

...

Details

This datasets were published in september 2019.

Note

Downloaded from the GeoParquet release of rgeomex-py the first time it is used; see rgeomex_load().

Source

https://www.inegi.org.mx/temas/mg/#Descargas


pua_mx

Description

Priority Urban Areas of Mexico

Usage

pua_mx

Format

A sf object with 111 rows and 3 variables:

id

the ids.

loc

name of the priority urban area

geometry

geometry column

...

Details

This database was built using data from high-risk locations, called hrl_mx in rgeomex

Note

Downloaded from the GeoParquet release of rgeomex-py the first time it is used; see rgeomex_load().

Source

https://geosis.mx/Aplicaciones/EntomologiayControl/Home/IndexNacional


Folder of the downloaded datasets

Description

The datasets of rgeomex are downloaded the first time they are used and kept in this folder. By default it is the user cache folder of R (tools::R_user_dir("rgeomex", "cache")). Set the environment variable RGEOMEX_DATA_DIR (or the option rgeomex.data_dir) to use another folder, for example a shared folder or a folder that already has the files (offline use).

Usage

rgeomex_cache_dir()

Value

the path of the folder.

Examples

rgeomex_cache_dir()

Delete the downloaded datasets

Description

Deletes the GeoParquet files of the cache folder. They are downloaded again when they are needed.

Usage

rgeomex_clear_cache()

Value

the number of deleted files, invisibly.

Examples

## Not run: 
rgeomex_clear_cache()

## End(Not run)

Table of the available datasets

Description

Table of the available datasets

Usage

rgeomex_datasets()

Value

a data.frame with the name of each dataset, whether it is split by state and whether it has geometry.

Examples

rgeomex_datasets()

Load a dataset

Description

Reads a dataset of rgeomex. The file is downloaded the first time it is used (see rgeomex_cache_dir()); later it is read from the cache.

Usage

rgeomex_load(dataset, cve_edo = NULL)

Arguments

dataset

name of the dataset (see rgeomex_datasets()), for example "AGEM_inegi19_mx" or "blocks_ine20_mx".

cve_edo

INEGI state key(s), from "01" to "32" (numbers are also accepted). It is required for the datasets split by state ("AGEB_inegi_2019", "blocks_ine20_mx", "blocks_ine20_mx_centroid", "sectores_ine20_mx"); for the other datasets it filters the rows of the state(s).

Value

a sf object (a data.frame for "iter_2020_loc").

Author(s)

Felipe Antonio Dzul Manzanilla [email protected].

Examples

yuc <- rgeomex_load("AGEM_inegi19_mx", cve_edo = "31")
blocks <- rgeomex_load("blocks_ine20_mx", cve_edo = "31")

Polygons of sectores from México of the National Electoral Institute 2020

Description

A spatial dataset containing of polygon data of sectores from México

Usage

sectores_ine20_mx_a

Format

A sf object with 17833 rows and 7 variables:

gid

the ids.

id

the ids.

entidad

is the numeric key of state.

distrito

is the numeric key of federal district.

distrito_l

is the numeric key of federal district.

municipio

is the numeric key to the Municipality

seccion

is the numeric key to the Sectors

tipo

is numeric the key of tipo

geometry1_

is the simple feature

ln
pad
geometry

simple feature.

...

Details

This datasets were published in october 2023.

Note

Downloaded from the GeoParquet release of rgeomex-py the first time it is used; see rgeomex_load().

Source

https://pautas.ine.mx/transparencia/mapas/


Polygons of sectores from México of the National Electoral Institute 2020

Description

A spatial dataset containing of polygon data of sectores from México

Usage

sectores_ine20_mx_b

Format

A sf object with 27428 rows and 7 variables:

gid

the ids.

id

the ids.

entidad

is the numeric key of state.

distrito

is the numeric key of federal district.

distrito_l

is the numeric key of federal district.

municipio

is the numeric key to the Municipality

seccion

is the numeric key to the Sectors

tipo

is numeric the key of tipo

geometry1_

is the simple feature

ln
pad
geometry

simple feature.

...

Details

This datasets were published in october 2023.

Note

Downloaded from the GeoParquet release of rgeomex-py the first time it is used; see rgeomex_load().

Source

https://pautas.ine.mx/transparencia/mapas/


Polygons of sectores from México of the National Electoral Institute 2020

Description

A spatial dataset containing of polygon data of sectores from México

Usage

sectores_ine20_mx_c

Format

A sf object with 23175 rows and 11 variables:

gid

the ids.

id

the ids.

entidad

is the numeric key of state.

distrito

is the numeric key of federal district.

distrito_l

is the numeric key of federal district.

municipio

is the numeric key to the Municipality

seccion

is the numeric key to the Sectors

tipo

is numeric the key of tipo

geometry1_

is the simple feature

ln
pad
geometry

simple feature.

...

Details

This datasets were published in october 2023.

Note

Downloaded from the GeoParquet release of rgeomex-py the first time it is used; see rgeomex_load().

Source

https://pautas.ine.mx/transparencia/mapas/


ua_mx

Description

Urban Areas of Mexico

Usage

ua_mx

Format

A sf object with 658 rows and 2 variables:

id

the ids.

geometry

geometry column

...

Details

La base de las area urbana de mexico derivada de la base de las areas global urbanas de meta data for goof of facebook

Note

Downloaded from the GeoParquet release of rgeomex-py the first time it is used; see rgeomex_load().

Source

https://dataforgood.facebook.com/dfg/tools/globalurbanareas