All examples By author By category About

diegovalle

Projected Topojson of Mexican Municipalities

Projected topojson example of a choropleth of Mexican municipalities and states with tooltips and each municipality colored by the number of people who live there

First download the shapefiles of Mexico (AGEBs, Manzanas, Municipios, Estados, etc) 1.4GB from

http://www.diegovalle.net/projects.html#url=%23datasets

Then convert the files 'shps/national/national_municipal.shp' and 'shps/national/national_estatal.shp' to topojson with

topojson \
    --width 960 \
    --height 800 \
    --margin 0 \
    -s .25 \
    --projection 'd3.geo.mercator()' \
    -o national.json \
    --id-property=+CVE_ENT,+CVE_MUN \
    -p +CVE_ENT,+CVE_MUN,NOM_MUN,+POB1 \
    counties=national_municipal.shp \
    states=national_estatal.shp

Based on Mike Bostock's Projected TopoJSON example https://gist.github.com/mbostock/5557726