Posted on Wed 27 February 2013

Download electoral shapefiles of Mexico


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






This work is licensed under a Creative Commons Attribution License.

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

Blogs I like: