Skip to content

Instantly share code, notes, and snippets.

@mpmckenna8
Last active May 18, 2016 21:35
Show Gist options
  • Save mpmckenna8/2898147c0bf6bcd157f2c2b4aee5623a to your computer and use it in GitHub Desktop.
Save mpmckenna8/2898147c0bf6bcd157f2c2b4aee5623a to your computer and use it in GitHub Desktop.
BaySat
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.graticule {
fill: none;
stroke: #777;
}
.boundary {
fill: red;
fill-opacity: .8;
stroke: #000;
}
svg {
background:aqua;
}
</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.v1.min.js"></script>
<script>
var width = 960,
height = 960;
var projection = d3.geo.satellite()
.distance(1.2)
.scale(20000)
.rotate([120.00, -37.250, 15.12])
.center([-2, 0])
.tilt(30)
.clipAngle(55)//(Math.acos(1 / 1.1) * 180 / Math.PI - 1e-6)
.precision(.1);
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("https://gist.githubusercontent.com/mbostock/4090846/raw/d534aba169207548a8a3d670c9c2cc719ff05c47/us-land.json", function(error, us) {
svg.append("path")
.datum(topojson.feature(us, us.objects.land))
.attr("class", "boundary")
.attr("d", path)
.attr("fill", "red");
});
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