Leaflet – Addressing and Solving the Multiverse Issue in Leaflet

leaflet

I hope someone can lend some insight here. My customer is complaining about what he calls the "multiverse" issue in Leaflet.

I apologize if I'm not using the right words to describe the problem.

As everyone knows, in leaflet you can scroll right/left on the map giving the appearance that you are "scrolling around the world"…however, each world map to the left and right are actually independently mapped using a continuum of longitudes…

For example, this picture shows (roughly) three earths:
multiverse

The left one from -540 to -180, middle from -180 to 180, right from 180 to 540.

And note the pin on the middle earth doesn't show on the left or right earths.

Is there any reasonable way to eliminate the "multiverse" feature (shy of replicating all of the elements N number of times)?

Best Answer

There are some options mentioned in the options for the Map object.

  • Set maxBounds with a longitude range of -180, 180
    • maxBoundsViscosity can be used to control the behaviour of panning at the edges
  • Set worldCopyJump to True
Related Question