title: Center a map in d3 given a geoJSON object
body: <p>Currently in d3 if you have a geoJSON object that you are going to draw you have to scale it and translate it in order to get it to the size that one wants and translate it in order to center it. This is a very tedious task of trial and error, and I was wondering if anyone knew a better way to obtain these values?</p>
  
  <p>So for instance if I have this code<br></p>
  
  <pre><code>var path, vis, xy;
  xy = d3.geo.mercator().scale(8500).translate([0, -1200]);
  
  path = d3.geo.path().projection(xy);
  
  vis = d3.select("#vis").append("svg:svg").attr("width", 960).attr("height", 600);
  
  d3.json("../../data/ireland2.geojson", function(json) {
    return vis.append("svg:g")
      .attr("class", "tracts")
      .selectAll("path")
      .data(json.features).enter()
      .append("svg:path")
      .attr("d", path)
      .attr("fill", "#85C3C0")
      .attr("stroke", "#222");
  });
  </code></pre>
  
  <p>How the hell do I obtain .scale(8500) and .translate([0, -1200]) without going little by little?</p>