block by mbostock 5349951

Ohio State Plane (N)

Full Screen

The counties of Ohio, generated via the us-atlas and using the Ohio State Plane North projection, part of the State Plane Coordinate System.

index.html

<!DOCTYPE html>
<meta charset="utf-8">
<style>

.county {
  fill: #eee;
}

.county:hover {
  fill: orange;
}

.county-border {
  fill: none;
  stroke: #777;
  pointer-events: none;
}

</style>
<body>
<script src="//d3js.org/d3.v3.min.js"></script>
<script src="//d3js.org/topojson.v1.min.js"></script>
<script>

var width = 960,
    height = 1200;

var projection = d3.geo.conicConformal()
    .parallels([40 + 26 / 60, 41 + 42 / 60])
    .rotate([82 + 30 / 60, -39 - 40 / 60])
    .translate([width / 2, height / 2]);

var path = d3.geo.path()
    .projection(projection);

var svg = d3.select("body").append("svg")
    .attr("width", width)
    .attr("height", height);

d3.json("oh-counties.json", function(error, oh) {
  if (error) throw error;

  var counties = topojson.feature(oh, oh.objects.counties);

  projection
      .scale(1)
      .translate([0, 0]);

  var b = path.bounds(counties),
      s = .95 / Math.max((b[1][0] - b[0][0]) / width, (b[1][1] - b[0][1]) / height),
      t = [(width - s * (b[1][0] + b[0][0])) / 2, (height - s * (b[1][1] + b[0][1])) / 2];

  projection
      .scale(s)
      .translate(t);

  svg.selectAll("path")
      .data(counties.features.filter(function(d) { return d.id % 1000; }))
    .enter().append("path")
      .attr("class", "county")
      .attr("d", path)
    .append("title")
      .text(function(d) { return d.properties.name; });

  svg.append("path")
      .datum(topojson.mesh(oh, oh.objects.counties, function(a, b) { return a !== b; }))
      .attr("class", "county-border")
      .attr("d", path);
});

d3.select(self.frameElement).style("height", height + "px");

</script>