Open hjrobinson opened 5 years ago
@hjrobinson I have the same issue, have you fixed this?
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.
@hjrobinson Thank you for your reply. I will have a try with https://github.com/mpetroff/print-maps
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);