After loading a US zipcode topojson file I am getting an error in d3.js. groupdata
is undefined on this line:
function bind(group, groupData) {
var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), updateNodes = new Array(m), enterNodes = new Array(m), exitNodes = new Array(n), node, nodeData;
with an error of:
Uncaught TypeError: Cannot read property 'length' of undefined
My code that is calling and creating the paths is:
d3.json("data/us-atlas/us-zipcodes.json", function(error, topology) {
svg.selectAll("path")
.data(topojson.feature(topology, topology.objects.zipcodes).features)
.enter()
.append("path")
.attr("d", path)
});
I generated the zipcode topojson file from this repo: https://github.com/mbostock/us-atlas. When I inspect the topology object on load I see 32893 arcs under topology.objects.zipcodes.
I have successfully loaded counties under with the chloropleth example http://bl.ocks.org/mbostock/4060606 and am using a similar pattern as that.
I'm using d3.js version 3.2.8 and topojson.js version 1.2.3.
Any ideas? Is it a bad zipcode file or am I calling it wrong?