Skip to content

Instantly share code, notes, and snippets.

@wboykinm
Forked from mbostock/.block
Created January 30, 2013 19:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wboykinm/4676201 to your computer and use it in GitHub Desktop.
Save wboykinm/4676201 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.graticule {
fill: none;
stroke: #777;
}
.boundary {
fill: #ccc;
fill-opacity: .8;
stroke: #000;
}
</style>
<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 = 960;
var projection = d3.geo.satellite()
.distance(1.1)
.scale(5500)
.rotate([76.00, -34.50, 32.12])
.center([-2, 5])
.tilt(25)
.clipAngle(25);
var graticule = d3.geo.graticule()
.extent([[-93, 27], [-47 + 1e-6, 57 + 1e-6]])
.step([3, 3]);
var path = d3.geo.path()
.projection(projection);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
svg.append("path")
.datum(graticule)
.attr("class", "graticule")
.attr("d", path);
d3.json("../4090846/us-land.json", function(error, us) {
svg.append("path")
.datum(topojson.object(us, us.objects.land))
.attr("class", "boundary")
.attr("d", path);
});
d3.select(self.frameElement).style("height", height + "px");
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment