Posted on Wed 27 February 2013

Download electoral shapefiles of Mexico (secciones, distritos, and colonias)



I’ve created a set of scripts to download and recode shapefiles from the IFE and INEGI. Once you run the scripts you’ll find in the map-out directory:

  • distritos: Shapefile of the electoral distritos (districts)
  • secciones-inegi: Shapefile of electoral secciones (precincts) with both the ife and inegi codes for the municipalities each seccion belongs to
  • estados: Shapefile of the Mexican states according to the INEGI
  • localidades: Shapefiles of the rural localities and the polygons of the urban ones
  • municipios: Shapefile of the municipalities of Mexico according to the INEGI
  • rdata-secciones: serialized secciones (precincts) map as an R object

Since the IFE uses a different coding standard for the municipalities of Mexico than the INEGI, I’ve recoded the municipality codes so that they match the ones the INEGI uses.


Ecatepec, México according to the INEGI is 15 033, while according to the IFE it’s 15 034
Guadalajara, Jalisco according to the INEGI is 14 039, while according to the IFE it’s 14 041

These codes are only available for the secciones electorales (precincts) shapefile and they are contained in the variables:

  • MUN_INEGI: The inegi municipio codes
  • MUN_IFE: The original ife municipio codes that came with the file

The codebook for the the census data that comes with the distrito and sección shapefiles is in the FD_SECC_IFE.pdf file and the ife and inegi codes are in the ife.to.inegi.csv file. I also suggest you check out Rob Hidalgo’s repository of public information (from freedom of information requests) which includes a shapefile of the municipios of Mexico according to the IFE (my version comes from the INEGI and they differ by a few municipalities)

P.S. Here’s the code

Update: You can also use a docker image to run the program without installing anything

1
2
3
4
5
docker pull diegovalle/download-maps12
# shared directory to store the output
mkdir -p /tmp/download-ine2010 
# once the container is up run make
docker run -v /tmp/download-ine2010:/download-maps12/map-out -i -t diegovalle/download-maps12



Unless otherwise stated, the content of this page is licensed under the Creative Commons Attribution 3.0 License, and code samples are licensed under the Apache 2.0 License. Privacy policy

Disclaimer: This website is not affiliated with any of the organizations or institutions to which Diego Valle-Jones belongs. All opinions are my own.

Special Projects:

Blogs I like: