Topojson for zip code data

1,239 views
Skip to first unread message

Anna Flagg

unread,
Sep 12, 2013, 3:34:25 PM9/12/13
to d3...@googlegroups.com
I'm trying to generate a topojson of US zip codes, as outlined here.

I was able to make the counties topojson, but with the zip codes file the process has been running for more than 12 hours, and I can't tell whether it's making progress. I think it's stuck somewhere, because the zip-codes.json file has been created, but nothing has been written to it.

There's also this set of instructions, but it fails for specifically the zip codes file (works for others).

Has anyone managed to make a zip codes topojson? Any help would be appreciated, thanks.

Mike Bostock

unread,
Sep 13, 2013, 8:35:19 PM9/13/13
to d3...@googlegroups.com
I’m investigating.

Usually when topojson appears to hang, it’s because it’s effectively out of memory and it’s spending all its time paging. TopoJSON 1.4.0 introduced a new, more memory-efficient hashtable; however, it’s possible that the linear probing in this hashtable implementation is causing frequent collisions, which would make the code slower.

So, I’m investigating to see whether there’s a bug, or a potential optimization, or if more memory is needed to convert such a large input file…

Of course, since the zip code tabulation areas are so large, you rarely want to create a TopoJSON file from it that you would serve on the web, so you might have more luck either slicing it into tiles (raster or vector) or rasterizing the whole thing as an image by reading the shapefile [1] directly.

Mike

marshal simmons

unread,
Sep 18, 2013, 5:17:57 PM9/18/13
to d3...@googlegroups.com, mi...@ocks.org
"Of course, since the zip code tabulation areas are so large, you rarely want to create a TopoJSON file from it that you would serve on the web, so you might have more luck either slicing it into tiles (raster or vector) or rasterizing the whole thing as an image by reading the shapefile [1] directly."

If you know of any, can you point me to any examples of doing this (mostly using the data once it's transformed)?  I'm trying to do something similar to http://strenuus-choropleth.nodejitsu.com/ but with zipcodes.  That example uses mapbox and topojson for all US counties.  The zipcode topojson is going to be too big to do that approach, as you mentioned.

My plan at the moment is to chop the zipcode shapefile into states and convert that to topojson.  Also I should mention that the data isn't static, so I can't use a solution like tilemill.

Any help is appreciated!

Mike Bostock

unread,
Sep 18, 2013, 6:46:44 PM9/18/13
to marshal simmons, d3...@googlegroups.com
Sure, take look at the rasterize script from the us-rivers project:

Reply all
Reply to author
Forward
0 new messages