modified from /mbostock/3795040 response to this stack overflow question
xxxxxxxxxx
<meta charset="utf-8">
<body>
<script src="https://d3js.org/d3.v3.min.js"></script>
<script src="https://d3js.org/topojson.v1.min.js"></script>
<style>
.land {
fill: #B6C598;
stroke: #818141;
}
.arc {
fill: red;
fill-opacity: 0.3;
stroke: black;
stroke-opacity: 0.5;
}
</style>
<script>
var width = 960,
height = 500,
bb = {W: -5.0, N: 50.0, E: 10.0, S: 40.0 };
var projection = d3.geo.orthographic()
.scale(250)
.translate([width / 2, height / 2])
.clipAngle(90);
var path = d3.geo.path()
.projection(projection);
var arc = d3.geo.graticule()
.majorExtent([[bb.W, bb.S], [bb.E, bb.N]])
var λ = d3.scale.linear()
.domain([0, width])
.range([-180, 180]);
var φ = d3.scale.linear()
.domain([0, height])
.range([90, -90]);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
svg.on("mousemove", function() {
var p = d3.mouse(this);
projection.rotate([λ(p[0]), φ(p[1])]);
svg.selectAll("path.land").attr("d", path);
svg.selectAll("path.arc").attr("d", path(arc.outline()));
});
d3.json("world-110m.json", function(error, world) {
svg.append("path")
.datum(topojson.feature(world, world.objects.land))
.attr("class", "land")
.attr("d", path);
svg.append("path")
.attr("class", "arc")
.attr("d", path(arc.outline()));
});
</script>
Modified http://d3js.org/d3.v3.min.js to a secure url
Modified http://d3js.org/topojson.v1.min.js to a secure url
https://d3js.org/d3.v3.min.js
https://d3js.org/topojson.v1.min.js