Skip to content

Instantly share code, notes, and snippets.

Forked from mbostock/.block
Last active February 9, 2016 02:11
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Blocky Counties
license: gpl-3.0
<!DOCTYPE html>
<meta charset="utf-8">
path {
fill: none;
stroke: steelblue;
<script src="//"></script>
<script src="//"></script>
var width = 960,
height = 500;
var projection = d3.geo.albersUsa()
.translate([width / 2, height / 2]);
var path = d3.geo.path()
var svg ="body").append("svg")
.attr("width", width)
.attr("height", height);
d3.json("/mbostock/raw/4090846/us.json", function(error, us) {
if (error) throw error;
.attr("d", topojson.feature(us, us.objects.counties).features
.filter(function(d) { return d.geometry && d.geometry.coordinates.length; })
.map(function(d) { var b = path.bounds(d); return "M" + b[0] + "H" + b[1][0] + "V" + b[1][1] + "H" + b[0][0] + "Z"; })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment