Skip to content

Instantly share code, notes, and snippets.

@tomstove
Created April 24, 2013 11:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomstove/5451481 to your computer and use it in GitHub Desktop.
Save tomstove/5451481 to your computer and use it in GitHub Desktop.
Europe from night
<!DOCTYPE html>
<head>
<style>
body {
background: #040C1F;
}
.urbanareas {
fill: silver;
fill-opacity: 0.8;
}
</style>
</head>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/d3.geo.projection.v0.min.js"></script>
<script src="http://d3js.org/topojson.v0.min.js"></script>
<script>
var width = 960,
height = 500;
var projection = d3.geo.satellite()
.translate([width/2, height/2])
.rotate([-2.724609375, -48.1074311885])
.scale(1200)
.tilt(20)
.clipAngle(Math.acos(1 / 1.1) * 180 / Math.PI - 1e-6)
var path = d3.geo.path()
.projection(projection);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
var urbanareas = svg.append("g");
d3.json('urbanareas.topo.json', function(err, data) {
urbanareas.append("path")
.datum(topojson.object(data, data.objects.urbanareas))
.attr("class", "urbanareas")
.attr("d", path);
});
</script>
</body>
</html>
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment