Center a map in d3 given a geoJSON object
My answer is close to Jan van der Laan’s, but you can simplify things slightly because you don’t need to compute the geographic centroid; you only need the bounding box. And, by using an unscaled, untranslated unit projection, you can simplify the math. The important part of the code is this: // Create a unit … Read more