D3.js 缺少外部边界
在呈现topojson时,我缺少状态的外部边界 例如,我对南方的看法如下: 相反,我需要填充所有外部边界 我的地图样式如下:D3.js 缺少外部边界,d3.js,topojson,D3.js,Topojson,在呈现topojson时,我缺少状态的外部边界 例如,我对南方的看法如下: 相反,我需要填充所有外部边界 我的地图样式如下: .state-boundary { stroke: #00001d; stroke-width: .5px; fill: white; stroke-linejoin: round; stroke-linecap: round; } svg.append("path")
.state-boundary {
stroke: #00001d;
stroke-width: .5px;
fill: white;
stroke-linejoin: round;
stroke-linecap: round;
}
svg.append("path")
.datum(topojson.mesh(topology, topology.objects.south, function(a, b) { return a !== b; }))
.attr("d", path)
.attr("class", "state-boundary");
在转换为topojson之前,geojson如下所示:
我的d3如下:
.state-boundary {
stroke: #00001d;
stroke-width: .5px;
fill: white;
stroke-linejoin: round;
stroke-linecap: round;
}
svg.append("path")
.datum(topojson.mesh(topology, topology.objects.south, function(a, b) { return a !== b; }))
.attr("d", path)
.attr("class", "state-boundary");
所以,这只是一个改变网格方法的问题。我真的不明白其中的区别,所以也许有人可以插话:
svg.append("path")
.datum(topojson.mesh(topology, topology.objects.south))
.attr("d", path)
.attr("class", "state-boundary");
如何呈现您的拓扑结构?您使用的是什么库?浏览器中的D3。我使用Topojson命令行util创建了Topojson文件。您不能在该文件上使用mesh。当您只想拥有内部边界时,将使用“网格”。对于所有您需要使用的
topojson.feature
。