title: Getting the centroid of each polygon from a GeoJson multipolygon in d3.js
body: <p>I'm using d3.js for a non contiguous cartogram where countries are scaled depending on some data. I'm scaling from the centroid of each country/path in the svg generated from a GeoJson file, but this doesn't look good for countries described as a multipolygon, like the USA or Canada.</p>
  
  <p>I would like to find the centroid of each polygon forming a multipolygon, so I can rescale without translating them. For example, when using the centroid of the USA, Alaska moves towards the right (in a mercator projection) while the rest moves up. Ideally, Alaska would be scaled from its own centroid, so it would stay in the same position.</p>
  
  <p>Is it possible to iterate through each polygon in a multipolygon feature and get its centroid?</p>
  
  <p>Thanks!</p>