9

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?

wiesson
  • 6,544
  • 5
  • 40
  • 68

1 Answers1

14

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);
wiesson
  • 6,544
  • 5
  • 40
  • 68
  • 1
    Thank you so much! I have been searching for days on end! – AKG Mar 24 '16 at 05:37
  • You're a time saver! Thanks! – Georgiy Bukharov Oct 06 '22 at 11:14
  • Maybe you also figured out how to remove a line which appears there after rotate? – Georgiy Bukharov Oct 06 '22 at 11:20
  • 1
    @GeorgiyBukharov You should have topology coordinates file. In that file you can find that small part of Russia as a separate country. Just move those topology coordinates to "Russia" MultiPolygon object. This is usually defined in JSON file. After that you should have Russia merged without line between them. – Milan Milicevic Jun 20 '23 at 07:46