【发布时间】:2013-09-26 09:12:22
【问题描述】:
我在我的 MacOs 10.7.5 上安装了 gdal 1.10.1 和 topojson 1.4.0。 我已经下载了ne_110m_ocean 表格 Natural Earth。
我在 GeoJSON 中成功转换了 shape 文件:
ogr2ogr \
-f GeoJSON \
ocean.json \
ne_110m_ocean.shp
然后我将 GeoJSON 转换为 topojson:
topojson \
-o ocean_tj.json \
ocean=ocean.json \
当我使用 GeoJSON 文件进行绘图时,一切正常。
d3.json("ocean.json", function(json) {
svg.selectAll("path")
.data(json.features)
.enter()
.append("path")
.attr("d", path)
.style("fill", "steelblue");
});
当我使用 topojson 文件进行绘图时,我得到的是陆地的多边形,而不是海洋的多边形!!!!
d3.json("ocean_tj.json", function(topology) {
var ocean = topojson.feature(topology, topology.objects.ocean);
svg.append("path")
.datum(ocean)
.attr("d", path)
.style("fill", "red");
});
谁能帮忙?
提前致谢
【问题讨论】:
-
我在使用该文件时也得到了一些奇怪的结果。基本上,我在海洋和陆地颠倒的数据中间有一个条带。我用ShapeEscape。我会在 Google Groups 上发布一些内容,看看那里是否有人有任何想法。
-
我仍然不确定为什么会发生这种情况,但使用
no-force-clockwise解决了这个问题。如果有必要,我会进行更多调查并填写错误报告。