Last active
March 1, 2023 04:29
-
-
Save mbostock/9231621 to your computer and use it in GitHub Desktop.
Revisions
-
mbostock revised this gist
Feb 9, 2016 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ license: gpl-3.0 -
mbostock revised this gist
Oct 31, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -35,8 +35,8 @@ </style> <body> <script src="//d3js.org/d3.v3.min.js"></script> <script src="//d3js.org/topojson.v1.min.js"></script> <script> var width = 960, -
mbostock revised this gist
Jun 11, 2015 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -35,8 +35,8 @@ </style> <body> <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/topojson/1.6.19/topojson.min.js"></script> <script> var width = 960, @@ -79,6 +79,8 @@ .attr("d", path); d3.json("/mbostock/raw/4090846/world-50m.json", function(error, world) { if (error) throw error; g.insert("path", ".graticule") .datum(topojson.feature(world, world.objects.land)) .attr("class", "land") -
mbostock revised this gist
Mar 20, 2014 . 2 changed files with 18 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1 @@ A south polar azimuthal equidistant projection, oriented so that noon is as 12 o'clock, as in [xkcd:1335](http://xkcd.com/1335/). The map updates continuously. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -46,6 +46,7 @@ .scale(150) .translate([width / 2, height / 2]) .clipAngle(180 - 1e-3) .rotate([0, 90]) .precision(.1); var path = d3.geo.path() @@ -70,29 +71,30 @@ .attr("class", "fill") .attr("xlink:href", "#sphere"); var g = svg.append("g"); g.append("path") .datum(graticule) .attr("class", "graticule") .attr("d", path); d3.json("/mbostock/raw/4090846/world-50m.json", function(error, world) { g.insert("path", ".graticule") .datum(topojson.feature(world, world.objects.land)) .attr("class", "land") .attr("d", path); g.insert("path", ".graticule") .datum(topojson.mesh(world, world.objects.countries, function(a, b) { return a !== b; })) .attr("class", "boundary") .attr("d", path); d3.timer(function() { var now = new Date, today = d3.time.day.utc(now); g.attr("transform", "translate(" + width / 2 + "," + height / 2 + ")" + "rotate(" + ((now - today) / (1000 * 60 * 60 * 24) * 360 - 180) + ")" + "translate(" + -width / 2 + "," + -height / 2 + ")"); }); }); d3.select(self.frameElement).style("height", height + "px"); -
mbostock revised this gist
Mar 18, 2014 . 2 changed files with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1 @@ A south polar azimuthal equidistant projection, oriented so that noon is as 12 o'clock, as in [xkcd:1335](http://xkcd.com/1335/). The map updates once a minute. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -86,7 +86,7 @@ var feature = svg.selectAll("path"); redraw(); setInterval(redraw, 60000); function redraw() { var now = new Date, today = d3.time.day.utc(now); -
mbostock revised this gist
Feb 26, 2014 . 1 changed file with 59 additions and 39 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,33 @@ background: #fcfcfa; } .stroke { fill: none; stroke: #000; stroke-width: 3px; } .fill { fill: #fff; } .graticule { fill: none; stroke: #777; stroke-width: .5px; stroke-opacity: .5; } .land { fill: #222; } .boundary { fill: none; stroke: #fff; stroke-width: .5px; } </style> <body> <script src="http://d3js.org/d3.v3.min.js"></script> @@ -21,57 +48,50 @@ .clipAngle(180 - 1e-3) .precision(.1); var path = d3.geo.path() .projection(projection); var graticule = d3.geo.graticule(); var svg = d3.select("body").append("svg") .attr("width", width) .attr("height", height); svg.append("defs").append("path") .datum({type: "Sphere"}) .attr("id", "sphere") .attr("d", path); svg.append("use") .attr("class", "stroke") .attr("xlink:href", "#sphere"); svg.append("use") .attr("class", "fill") .attr("xlink:href", "#sphere"); svg.append("path") .datum(graticule) .attr("class", "graticule"); d3.json("/mbostock/raw/4090846/world-50m.json", function(error, world) { svg.insert("path", ".graticule") .datum(topojson.feature(world, world.objects.land)) .attr("class", "land"); svg.insert("path", ".graticule") .datum(topojson.mesh(world, world.objects.countries, function(a, b) { return a !== b; })) .attr("class", "boundary"); var feature = svg.selectAll("path"); redraw(); setInterval(redraw, 1000); function redraw() { var now = new Date, today = d3.time.day.utc(now); projection.rotate([(now - today) / (1000 * 60 * 60 * 24) * 360 - 180, 90]); feature.attr("d", path); } }); -
mbostock revised this gist
Feb 26, 2014 . 1 changed file with 39 additions and 59 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,33 +6,6 @@ background: #fcfcfa; } </style> <body> <script src="http://d3js.org/d3.v3.min.js"></script> @@ -48,50 +21,57 @@ .clipAngle(180 - 1e-3) .precision(.1); var canvas = d3.select("body").append("canvas") .attr("width", width) .attr("height", height); var context = canvas.node().getContext("2d"); var path = d3.geo.path() .projection(projection) .context(context); d3.json("/mbostock/raw/4090846/world-50m.json", function(error, world) { var sphere = {type: "Sphere"}, graticule = d3.geo.graticule()(), land = topojson.feature(world, world.objects.land), borders = topojson.mesh(world, world.objects.countries, function(a, b) { return a !== b; }); redraw(); setInterval(redraw, 1000); function redraw() { var now = new Date, today = d3.time.day.utc(now); projection.rotate([(now - today) / (1000 * 60 * 60 * 24) * 360 - 180, 90]); context.clearRect(0, 0, width, height); context.beginPath(); path(sphere); context.lineWidth = 3; context.strokeStyle = "#000"; context.stroke(); context.fillStyle = "#fff"; context.fill(); context.beginPath(); path(land); context.fillStyle = "#222"; context.fill(); context.beginPath(); path(borders); context.lineWidth = .5; context.strokeStyle = "#fff"; context.stroke(); context.beginPath(); path(graticule); context.lineWidth = .5; context.strokeStyle = "rgba(119,119,119,.5)"; context.stroke(); } }); -
mbostock revised this gist
Feb 26, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
LoadingSorry, something went wrong. Reload?Sorry, we cannot display this file.Sorry, this file is invalid so it cannot be displayed. -
mbostock revised this gist
Feb 26, 2014 . 2 changed files with 16 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1 @@ A south polar azimuthal equidistant projection, oriented so that noon is as 12 o'clock, as in [xkcd:1335](http://xkcd.com/1335/). The map updates once a second. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -40,15 +40,12 @@ <script> var width = 960, height = 960; var projection = d3.geo.azimuthalEquidistant() .scale(150) .translate([width / 2, height / 2]) .clipAngle(180 - 1e-3) .precision(.1); var path = d3.geo.path() @@ -75,19 +72,27 @@ svg.append("path") .datum(graticule) .attr("class", "graticule"); d3.json("/mbostock/raw/4090846/world-50m.json", function(error, world) { svg.insert("path", ".graticule") .datum(topojson.feature(world, world.objects.land)) .attr("class", "land"); svg.insert("path", ".graticule") .datum(topojson.mesh(world, world.objects.countries, function(a, b) { return a !== b; })) .attr("class", "boundary"); var feature = svg.selectAll("path"); redraw(); setInterval(redraw, 1000); function redraw() { var now = new Date, today = d3.time.day.utc(now); projection.rotate([(now - today) / (1000 * 60 * 60 * 24) * 360 - 180, 90]); feature.attr("d", path); } }); d3.select(self.frameElement).style("height", height + "px"); -
mbostock created this gist
Feb 26, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ A south polar azimuthal equidistant projection, oriented so that noon is as 12 o'clock, as in [xkcd:1335](http://xkcd.com/1335/). This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,95 @@ <!DOCTYPE html> <meta charset="utf-8"> <style> body { background: #fcfcfa; } .stroke { fill: none; stroke: #000; stroke-width: 3px; } .fill { fill: #fff; } .graticule { fill: none; stroke: #777; stroke-width: .5px; stroke-opacity: .5; } .land { fill: #222; } .boundary { fill: none; stroke: #fff; stroke-width: .5px; } </style> <body> <script src="http://d3js.org/d3.v3.min.js"></script> <script src="http://d3js.org/topojson.v1.min.js"></script> <script> var width = 960, height = 960, now = new Date, today = d3.time.day.utc(now); var projection = d3.geo.azimuthalEquidistant() .scale(150) .translate([width / 2, height / 2]) .clipAngle(180 - 1e-3) .rotate([(now - today) / (1000 * 60 * 60 * 24) * 360 - 180, 90]) .precision(.1); var path = d3.geo.path() .projection(projection); var graticule = d3.geo.graticule(); var svg = d3.select("body").append("svg") .attr("width", width) .attr("height", height); svg.append("defs").append("path") .datum({type: "Sphere"}) .attr("id", "sphere") .attr("d", path); svg.append("use") .attr("class", "stroke") .attr("xlink:href", "#sphere"); svg.append("use") .attr("class", "fill") .attr("xlink:href", "#sphere"); svg.append("path") .datum(graticule) .attr("class", "graticule") .attr("d", path); d3.json("/mbostock/raw/4090846/world-50m.json", function(error, world) { svg.insert("path", ".graticule") .datum(topojson.feature(world, world.objects.land)) .attr("class", "land") .attr("d", path); svg.insert("path", ".graticule") .datum(topojson.mesh(world, world.objects.countries, function(a, b) { return a !== b; })) .attr("class", "boundary") .attr("d", path); }); d3.select(self.frameElement).style("height", height + "px"); </script>