0

In every D3 map example I can find, the scale parameter of the Mercator projection is set to equal width / 2 / Math.PI. Is this unique to the Mercator projection? What is scale doing that it needs to rely on pi? I'd love to have a more intuitive understanding of what's going on here, but the docs are pretty sparse.

"If scale is specified, sets the projection’s scale factor to the specified value and returns the projection. If scale is not specified, returns the current scale factor which defaults to 150. The scale factor corresponds linearly to the distance between projected points. However, scale factors are not consistent across projections."

4

1 回答 1

1

卡托投影代码使用大量三角函数在角度纬度/经度坐标和笛卡尔 x/y 坐标之间进行转换。我很确定这width/2/Math.PI只是确保整个地球都适合一个width. (在代码中,您的输入比例因子乘以 pi。)如果您没有绘制整个地球的地图,您需要自己找出一个合适的比例因子。

于 2014-02-11T17:12:44.733 回答