I am having a lot of fun playing with topojson, but it looks like topojson.object is undefined in V1 of topojson, where it was supported in V0. Can someone explain how I might work around this issue? I am trying to draw distinct path elements for each polygon in an input file formatted as topojson. the code is:
d3.json("maTopo.json", function(error, ma) {
svg.selectAll(".subunit")
.data(topojson.object(ma, ma.objects.ma).geometries)
.enter().append("path")
.attr("class", function(d) { return "subunit " + d.id; })
.attr("d", path);
});
You can use topojson.feature
instead.
d3.json("maTopo.json", function(error, ma) {
svg.selectAll(".subunit")
.data(topojson.feature(ma, ma.objects.ma).features)
.enter().append("path")
.attr("class", function(d) { return "subunit " + d.id; })
.attr("d", path);
});
A detailed example can be found here: http://bost.ocks.org/mike/map/