This example demonstrates D3’s support for azimuthal projections and clipping to great circles! Release 2.3.0 also includes support for Gnomonic, Bonne, Werner and Sinusoidal projections, as well as for rendering great arcs.
xxxxxxxxxx
<meta charset="utf-8">
<style>
circle,
path {
fill: none;
stroke: #000;
}
circle {
stroke-width: 2px;
}
</style>
<body>
<script src="https://d3js.org/d3.v2.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/d3/d3-plugins/clip/geo/clip/clip.js"></script>
<script>
var width = 960,
height = 500,
radius = 240;
var origin = [-71, 42],
velocity = [.010, -.002],
t0 = Date.now();
var projection = d3.geo.azimuthal()
.mode("orthographic")
.scale(radius)
.translate([width / 2, height / 2]);
var clip = d3.geo.clip();
var path = d3.geo.path()
.projection(projection);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
d3.json("readme.json", function(err, geometry) {
var feature = svg.append("path")
.datum(geometry)
.attr("d", draw);
d3.timer(function() {
var t = Date.now() - t0,
o = [origin[0] + velocity[0] * t, origin[1] + velocity[1] * t];
projection.origin(o);
clip.origin(o);
feature.attr("d", draw);
});
function draw(d) {
return path(clip(d));
}
});
</script>
Modified http://d3js.org/d3.v2.min.js to a secure url
Updated missing url https://raw.github.com/d3/d3-plugins/clip/geo/clip/clip.js to https://cdn.jsdelivr.net/gh/d3/d3-plugins/clip/geo/clip/clip.js
https://d3js.org/d3.v2.min.js
https://raw.github.com/d3/d3-plugins/clip/geo/clip/clip.js