How to prevent wrapping the world map in the mapbox?

I am using a mapbox and a featureGroup element. The world map is repeated horizontally. How can I prevent the world map from repeating horizontally. I've tried "no-wrap: true" but that only seems to work for the tile layer. For featureGroup, please suggest some way.

var map = L.mapbox.map(mapData, MapBoxAccess.mapBoxAccess.accessId);
var featureGroup = L.featureGroup().addTo($scope.map);

      

I add my polygons and polylines to featureGroup

Please find the attached image for a better understanding.

repeat world map

+3


source to share


1 answer


This is actually intended behavior and functions cannot be repeated around the world like this. If you want to prevent scrolling around the world, you can set borders on the map so that someone cannot scroll or pan from side to side. In addition, there is a Leaflet method called WorldCopyJump , which also bounces the view back to the bounds.



+2


source







All Articles