单张进一步放大并拉伸图块 [英] Leaflet zoom in further and stretch tiles

查看:140
本文介绍了单张进一步放大并拉伸图块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在地图上放大足够远时,TileLayer消失,我看到一堆显示地图数据尚不可用"的图块.我相信这些图块可能来自提供商,但我不确定(我正在使用ESRI WorldImagery数据集).

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 the provider, but I am not sure (I am using ESRI WorldImagery dataset).

有什么方法可以在某个缩放级别上强制将图块拉伸,而不是请求该缩放级别的图块?我可以接受一些模糊处理,但是我需要进一步放大.

Is there any way to, at a certain zoom level, just force the tiles to stretch, instead of requesting the tiles for that zoom level? I am ok with some blur, but I do need to zoom in further.

我尝试使用zoomOffset选项,但是每当我在其中放置0以外的值时,我的图块就永远不会加载(全灰色).

I tried playing around with the zoomOffset option, but whenever I put something there other than 0, my tiles just never load (all grey).

谢谢!

推荐答案

这可以通过使用L.TileLayer的两个选项来解决.

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

首先,将maxNativeZoom设置为图块提供的最高缩放级别(地图数据不可用"开始出现之前的最后一个缩放级别-告诉Leaflet放大到此级别以上时,停止停止请求新图块;已拉伸)将会使用图块代替.

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.

第二,将maxZoom设置为合适的缩放比例;您可能不希望它比maxNativeZoom高几个级别,因为拉伸后的图块将开始看起来非常恐怖.

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.

您可以通过在L.TileLayer的文档中的选项"下进行检查来找到有关详细信息的更多信息: http://leafletjs .com/reference.html#tilelayer

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

这篇关于单张进一步放大并拉伸图块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆