我对topoJSON很新,并且使用下面的D3 bl.ocks教程来构建德克萨斯州的地图。
http://bl.ocks.org/darrenjaworski/5874214
我已将德克萨斯州的shapefile转换为topoJSON,现在我无法在屏幕上获得德克萨斯州的县。我认为这与以下几行有关...
d3.json("finaloutput.json", function(error, ok) {
var counties = topojson.feature(ok, ok.objects.county);
//counties
svg.append("g").attr("class", "county").selectAll("path").data(counties.features).enter().append("path").attr("d", path).style("fill", function(d) {
return color(d.properties.belowfpl);
});
//county borders
svg.append("path").datum(topojson.mesh(ok, ok.objects.county, function(a, b) {
return a !== b;
})).attr("class", "county-border").attr("d", path);
//state borders
svg.append("path").datum(topojson.mesh(ok, ok.objects.county, function(a, b) {
return a === b;
})).attr("class", "state-border").attr("d", path);
让德克萨斯州的县取代俄克拉荷马州的最简单方法是什么?
感谢。