Skip to content

Instantly share code, notes, and snippets.

@mbostock
Forked from mbostock/.block
Last active February 9, 2016 01:21
Show Gist options
  • Save mbostock/2870030 to your computer and use it in GitHub Desktop.
Save mbostock/2870030 to your computer and use it in GitHub Desktop.
Orthographic Projection
license: gpl-3.0
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!DOCTYPE html>
<meta charset="utf-8">
<title>Azimuthal (Orthographic) Projection</title>
<style>
path {
fill: #ccc;
stroke: #fff;
}
</style>
<svg width="960" height="500"></svg>
<script src="//d3js.org/d3.v3.min.js"></script>
<script>
var projection = d3.geo.orthographic()
.clipAngle(90)
.scale(240);
var path = d3.geo.path()
.projection(projection);
var svg = d3.select("svg");
d3.json("countries.json", function(error, collection) {
if (error) throw error;
svg.selectAll("path")
.data(collection.features)
.enter().append("path")
.attr("d", path);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment