使用fitSize函数无法正确显示功能

时间:2019-05-02 12:39:28

标签: d3.js geospatial geojson topojson

我尝试使用D3和TopoJSON文件创建城市地图。我的问题是功能显示不正确。功能非常小且混乱。

我尝试使用fitSize函数对其进行修复,但未成功。 当我使用以下代码时,功能 可以正确显示:

let projection = d3.geoMercator()
    .center([6.6314,53.3423])
    .scale(30060)
    .translate([width / 2, height / 2]);

但是我仍然想知道为什么它不能与fitSize一起使用。

我这样使用fitSize:

let projection = d3.geoMercator().fitSize([900, 600], topojson.feature(topology, topology.objects.gemeenten));

这将导致这样的地图:

enter image description here

这是我的示例代码:http://bl.ocks.org/FrieseWoudloper/7f8634088803206fca6330c7658bf8b8

0 个答案:

没有答案