Built with blockbuilder.org
forked from anonymous's block: Hello missile world
forked from anonymous's block: Hello missile world
xxxxxxxxxx
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v4.min.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
</style>
</head>
<body>
<script>
// Yeah - Feel free to change or delete any of the code you see in this editor!
var svg = d3.select("body").append("svg")
.attr("width", 1000)
.attr("height", 500)
//projection = d3.geoOrthographic()
projection = d3.geoAzimuthalEquidistant()
.rotate([180,-30])
.fitExtent([[0,0],[600,500]], {type:"Sphere"});
svg.append("path")
.datum({type:"Sphere"})
.attr("fill","lightblue")
path = d3.geoPath(projection);
land = svg.append("path")
line = {type:"LineString",
coordinates:[[-150,0],[0,0]]
}
svg.append("path")
.datum(line)
.attr("d",path)
.attr("stroke", "red")
.attr("fill","none")
svg.append("path")
.attr("fill","yellow")
.datum({
type:"Multipoint",
coordinates:[[125.8,39]]})
d3.json("https://visionscarto.net/bxl/countries.geojson", function(err,json)
{land.datum(json);render()
})
svg.append("text")
.text(projection([0,0]))
.attr("y", 200)
.attr("x", 120)
.attr("font-size", 18)
.attr("font-family", "monospace")
function render(){
svg.selectAll("path")
.attr("d", path)
}
d3.timer(function(e){projection.rotate([e/10,-30]);render()})
</script>
</body>
https://d3js.org/d3.v4.min.js