Download electoral shapefiles of Mexico

on Feb 27, 2013
[Update: You can now download the shapefiles directly from the data page without running the script. Also be sure to also check out this post to download shapefiles of census areas (AGEBs) and blocks (manzanas)]

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 (mine comes from the INEGI and they differ by a few municipalities)

P.S. Here's the code

Don't miss a thing: Follow me @diegovalle on Twitter, grab the RSS feed or subscribe by email

4 comments:

Gabriel Anaya Ibarra said...

You are the greatest, thank you very much for opening a window in the closed world of INEGI. Keep up the good work. Thank you again.

Brendan Dawe said...

Thanks for the shapefiles

Li Chen said...

Thanks! Is it possible to crop the shapefile to keep only Mexico City and the state of Mexico based on your file?

Diego Valle-Jones said...

Li Chen, If you use QGIS it's very easy to subset a shapefile

Post a Comment

Thank you for your interesting and insightful comments. I truly look forward to reading them.