我在大约以太平洋为中心的世界地图上使用d3.geo.conicEquidistant()投影,我的目的是从一个点绘制圆圈,从地图上的这一点开始说明一个特定距离,比如说1000km.
如果给定特定的公里数,如何计算投影的正确半径?
这是我的代码示例(是的,它是关于来自朝鲜的导弹到达.使用人工平壤作为发射点:),在此问题的基础上:将圆的半径(以米为单位)缩放到D3.js d3.geo.mercator地图
<!DOCTYPE html>
<meta charset="utf-8">
<style>
path {
stroke: white;
stroke-width: 0.25px;
fill: grey;
}
circle {
stroke: red;
stroke-width: 1px;
stroke-dasharray: 5;
fill: transparent;
}
</style>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/topojson.v0.min.js"></script>
<script>
var width = 960,
height = 500;
var projection = d3.geo.conicEquidistant()
.center([0, 5 ])
.scale((width + 1) / 2 / Math.PI)//.scale(150)
.rotate([-160,0]);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
var path = d3.geo.path()
.projection(projection);
var g = svg.append("g");
var missiles = [ …Run Code Online (Sandbox Code Playgroud)