Image generation doesn't work for layers whose tiles are overscaled
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 380
- Forks
- 140
- PR merge metrics
- No merged PRs in 30d
Description
Leaflet will automagically overscale a layer's tiles when a map is zoomed passed the layer's maxNativeZoom. However, calling leafletImage() on a map with overscaled layers gives you back an empty image.
The issue is that handleTileLayer() uses the layer's initial tileSize (layer.options.tileSize), which doesn't account for the case when the layer's tiles have been overscaled. The quick fix for me was to replace tileSize = layer.options.tileSize; with tileSize = layer.getTileSize().x;.
Submitting this as an issue rather than a pull request since I'm not sure how backwards compatible the getTileSize() call is with older versions of Leaflet, and my quick hack doesn't handle non-square tile sizes.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting handleTileLayer(), especially how it reads layer.options.tileSize and whether Leaflet's getTileSize() is available across supported versions. Reproduce leafletImage() with a layer zoomed beyond maxNativeZoom, then verify the generated image is populated and that non-square tile sizes are handled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100