d3.jsgeotopojsond3.geo

d3.js geo worldmap - merge russia (shift small part from the left next to america to the right)


I created a simple worldmap with d3 as you can see here: http://bl.ocks.org/wiesson/ef18dba71256d526eb42

shift small part to the right

Is there a simple way to shift the small part of russia (as illustrated in the picture) to the right, without creating a new topojson? If not, any other idea?


Solution

  • Okay, the answer was straightforward. As explained in the api docs, the method rotate can turn the map. So, rotate([-11, 0]) "rotated" the map in the position I was looking for.

    var projection = d3.geo.mercator().scale(width / 2 / Math.PI)
        .rotate([-11, 0])
        .translate([(width) / 2, height * 1.35 / 2])
        .precision(.1);