mapbox / leaflet-image

leaflet maps to images
http://mapbox.github.io/leaflet-image/
BSD 2-Clause "Simplified" License
364 stars 142 forks source link

NativeZoom not Applied to Exported Image #127

Open hjrobinson opened 5 years ago

hjrobinson commented 5 years ago

NativeZoom option doesn't seem to be applied to exported image (you have missing tiles).
For example: L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z} /{y}/{x}.png', { maxNativeZoom: 16 }).addTo(map);

function doImage(err, canvas) { var img = document.createElement('img'); var dimensions = map.getSize(); img.width = dimensions.x; img.height = dimensions.y; img.src = canvas.toDataURL(); snapshot.innerHTML = ''; snapshot.appendChild(img); }

setTimeout(function() { leafletImage(map, doImage); }, 2000);

gihandilanka-github commented 3 years ago

@hjrobinson I have the same issue, have you fixed this?

hjrobinson commented 3 years ago

Ha, it's been a while since I commented on this. No, I didn't fix it. I basically ended up using Mapbox-GL-JS instead and this repo: https://github.com/mpetroff/print-maps Of course it would have been cool to export images directly with Leaflet and use the maxNativeZoom option.

gihandilanka-github commented 3 years ago

@hjrobinson Thank you for your reply. I will have a try with https://github.com/mpetroff/print-maps