I am working at zoom bounds to my map.
Unfortunately, if I go beyond the min zoom 2.75 I start to see the map beyond the World's edge. I mean, that the world map tends to be repeatable, but without the content visible on the main map.
As you can see in the image above (Zoom level 1) I have my main world map with the content, whereas other "maps" beyond the World's range are still visible with nothing. It makes my final map not neat enough.
After setting my bounds:
var SouthEast = L.latLng(-90,180),
NorthWest = L.latLng(90,-180),
Bounds = L.latLngBounds(SouthEast,NorthWest);
var map = L.map('map', {
zoomSnap: 0.25,
minZoom: 1,
maxBounds: Bounds,
maxBoundsViscosity: 1.0
}).setView([0, 0], 3);
and applying maxBoundsViscosity: 1.0
as explained in the example below:
it still not works as expected. The ma is fine from Zoom level higher than 2.75, but not valid for smaller zoom levels.
In turn the example here:
Setting bounds and making map bounce back if moved away
describes the situation, when we want to bounce back our map. It's even worse in my example because I cannot see the highest latitudes.
Is there any way to "switch off" these maps at smaller zoom levels? I would rather to see:
- grey background instead of blank map
OR - replicated content in these maps
How can I do this?
Best Answer
What you want to achieve cannot be done at the map level.
You can achieve this at the tile layer level with the
noWrap
option set totrue
. For example, for OSM layer this would look something like this: