5

MacOs 10.7.5 に gdal 1.10.1 と topojson 1.4.0 がインストールされています。ne_110m_oceanフォーム Natural Earthをダウンロードしました。

GeoJSON で形状ファイルを正常に変換しました。

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");
});

誰でも助けることができますか?

前もって感謝します

4

1 に答える 1