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 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

Mexican Presidential Election by District

on Feb 11, 2013
Check out the interactive map I made of the results of the presidential election in Mexico. I even used hierarchical clustering to group Mexico into five clusters according to how people vote (obviously the clusters are very rough and subject to statistical error).

These are the median values for the percentage of the vote for each party in the clusters:

Interpretation Cluster PRD PAN PRI
PRI 1 0.27 0.20 0.46
PRI-PAN 2 0.23 0.34 0.38
PRI-PRD 3 0.40 0.16 0.37
PRD 4 0.54 0.15 0.27
PAN 5 0.22 0.48 0.26