I want to use d3 to create a chloropleth that assigns different colors to different zip code regions in the United States. Similar to this, except with zip codes: http://bl.ocks.org/mbostock/4060606
However, I can't find a topojson of US zip codes. This offers a way to generate the topojson for zip codess:https://github.com/mbostock/us-atlas
but my Mac has been running their script for hours on end. Oddly, I can't find anyone on the Internet who has successfully generated the file of zip codes.
I could also use zip3 regions - basically zip code regions characterized by the first 3 digits. However, I can't find any topojson for this division.
Where can I find topojsons or files containing the shapes of either US zip codes or zip3 regions?
A zip code topojson is going to be too large to work with. A Zip3 geoJSON file is over 550MB with no simplification. With a simplification of 0.00001 it's over 370MB. If I take it to a simplification of 0.001 then you can get 39MB.Which will get down to 1.1MB after running it through topojson but you end up with a USA map that looks like a polygon from Everquest Texas is massively deformed. I think the happy medium is is 0.0001 this gives you a topojson file of bout 4.8MB. Here is the process.
ogr2ogr -simplify 0.0001 -f GeoJSON zip3.json zip3.shp
topojson --id-property ZIP3 -o zip3topo.json -- zip3.json
The ogr2ogr will take some time but now you have a topojson file that will render to look like this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With