Leaflet zoom in further and stretch tiles

前端 未结 1 1848
北恋
北恋 2020-12-09 16:56

When I zoom in far enough on my map, the TileLayer disappears and I see a bunch of tiles that say \"Map data not yet available\". I believe these tiles may be coming from th

相关标签:
1条回答
  • 2020-12-09 17:46

    This can be solved by using two of the options of L.TileLayer.

    First, set maxNativeZoom to the highest zoom level your tiles provide (the last zoom level before the "Map data not available" starts to appear - this tells Leaflet to stop requesting new tiles when zooming in beyond this level; stretched tiles will be used instead.

    Second, set maxZoom to whatever zoom is appropriate; you might not want this to be more than a couple of levels higher than maxNativeZoom, since the stretched tiles will start to look pretty horrible.

    You can find out more about the details by checking under "Options" in the documentation for L.TileLayer: http://leafletjs.com/reference.html#tilelayer

    0 讨论(0)
提交回复
热议问题