【发布时间】:2015-09-30 18:00:58
【问题描述】:
在渲染我的 topojson 时,我错过了状态的外部边界。
例如,我对南方的看法是这样的:
相反,我需要填充所有外部边界。
我的地图风格如下:
.state-boundary {
stroke: #00001d;
stroke-width: .5px;
fill: white;
stroke-linejoin: round;
stroke-linecap: round;
}
我的d3如下:
svg.append("path")
.datum(topojson.mesh(topology, topology.objects.south, function(a, b) { return a !== b; }))
.attr("d", path)
.attr("class", "state-boundary");
【问题讨论】:
-
如何渲染你的 topojson?你用的是什么库?
-
浏览器中的 D3。我使用 topojson 命令行工具制作了 Topojson 文件。
-
您不能在此使用网格。当您只想拥有内部边界时使用网格。对于所有你需要使用
topojson.feature。