我正在嘗試使用d3顯示澳大利亞。我中心我地圖,所以它會正確顯示無法將其旋轉屬性..d3js - 如何使用d3js旋轉地圖
下面是相關的代碼,
var projection = d3.geo.albers().scale(1).translate([0,0]);
var path = d3.geo.path().projection(projection);
var bounds = path.bounds(topojson.feature(dataSet, dataSet.objects.abs_aus_ced_2007));
var scale = 0.95 /Math.max((bounds[1][0] - bounds[0][0])/width, (bounds[1][1] - bounds[0][1])/height);
var translate = [(width - scale * (bounds[1][0] + bounds[0][0]))/2, (height - scale * (bounds[1][1] + bounds[0][1]))/2];
projection.scale(scale).translate(translate);
path = d3.geo.path().projection(projection);
地圖順時針旋轉大約80度。我不能工作了解如何糾正旋轉以正確顯示地圖。
任何指針都會很棒!
感謝利亞,嘗試,仍然沒有luck..wish我可以上傳圖片,所以你可能需要看。讓我有一個去任何方式..小兒子說,如果' - '是我需要顯示,圖像正在合成爲'\',所以我認爲..我需要旋轉圖像,以便它出現'' - 」。希望它是有道理的。此外,我也使用質心法自動找出中心。我幾乎得到了相同的中心.. – genwip