javascriptleafletworld-map

Leaflet + noWrap option not working in above 1.x version


I am working in leaflet map chart. I tried to implement the nowrap option but its not working. please anyone suggest to solve this problem.

I attached my code:

var map = L.map('map', {
    worldCopyJump: true,
    inertia: false
}).setView([10.8, -140.7], 2);

//  OSM tiles
//L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
L.tileLayer('http://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png',{
     maxZoom: 18,
     continuousWorld: false,
     noWrap: true
}).addTo(map);

var marker = L.marker([-29.5, 143]).addTo(map);
marker.bindPopup('-29.5, 143');

Important

When i am using this theme "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" its working but when i tried to use dark theme not working. same code working in 0.x version.

http://jsfiddle.net/rajinikumarr/JKFgD/46

Attachment: enter image description here

Excepting output: The map should not repeat at any resolution.


Solution

  • I need to remove repeated map for all resolutions.

    Use the bounds option of the TileLayer.