0

We have a project where we would like to display a vector map, but offset the centre from the meridian so that Asia is more central.

I can use d3.geo.equirectangular().center([-155.0, 0]) to translate the map, but there is (obviously) no wrapping, so we lose everything east of Scandinavia.

Is there a way of making the map "wrap" in a 2D projection without rendering 2 maps.

Ideally, I would not like to use map tiling, etc. because our requirements are fairly simple in that we need a base whole map and 1 or 2 levels of zoom with layers that can be dynamic.

skila
  • 69
  • 5
  • [This question](http://stackoverflow.com/questions/14909054/zooming-and-panning-a-mercator-map-centered-on-the-pacific-using-d3-js) may help. – Lars Kotthoff Feb 05 '14 at 13:25

1 Answers1

1

thanks very much @LarsKotthoff, I found the solution in those answers:

d3.geo.equirectangular().rotate([-155,0])
blackgreen
  • 34,072
  • 23
  • 111
  • 129
skila
  • 69
  • 5
  • Here's the relevant [D3 version 4 docs](https://github.com/d3/d3-geo/blob/master/README.md#projection_rotate) - worth mentioning it's a 3-value array `[ yaw, pitch, roll ]`, but you can skip the third value like this and it'll default to 0. It's basically the same in D3 v4 except it'd be something like `d3.geoEquirectangular().rotate([-155,-0])` without the `.geo` – user56reinstatemonica8 Apr 05 '17 at 16:05