Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 509
wiesson Avatar asked Dec 15 '15 19:12

wiesson


1 Answers

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);
like image 178
wiesson Avatar answered Nov 09 '22 00:11

wiesson