Show tile layer at very high zoom

自作多情 提交于 2019-12-04 18:32:51

I'm not sure about Google Maps, but for OpenLayers the short answer is that there is no built in way. There is a one to one mapping between a WMTS resource and its URL. So, there are a known number of zoom levels with fixed resolutions and from the view port extents and the zoom level the correct tiles will be returned based on /zoom/y/x.jpeg. So, once you have got to the maximum zoom, you would have to have to extend the WMTS code to rescale the existing backbuffer images rather than requesting a new layer from the server. So, it is doable, if a bit messy.

If you look at the source for OpenLayers.Layer.Tile you will see a method applyBackBuffer which does tile rescaling and is called by a zoom event, assuming transitionEffect:resize is set on the WMS/WMTS source (which is the default). You would need to use this logic and prevent calls to getURL in [OpenLayers.Layer.WMTS] once you have got to the maximum zoom for your WMTS. The getURL function is actually called by OpenLayer.Tile.Image, which is the class that represents individual tiles WMS or WMTS.

So, that is the longer answer, doable, but messy, as you are mixing two different approaches to tiles.

It is also worth mentioning that even if you did this, it would look awful very quickly. When you zoom from a resolution of 4 to 2, you are resampling in both x and y dimensions, so effectively only have 25% of the original pixels, going from 4 to 1, you are looking at 1/16th of the original tiles pixels, as each new pixel will be a resampling of 4 pixels in both x and y direction.

jirikadlec2

I found a simple solution using Leaflet. In the Leaflet tileLayer, I can set maxNativeZoom and maxZoom.

maxNativeZoom is the maximum zoom level supported by the tile data provider.

maxZoom is the maximum zoom level to display the stretched tiles in my map.

The answer is here: Leaflet zoom in further and stretch tiles

It works and looks quite OK when I zoom-in a few levels beyond the maxNativeZoom. The disadvantage is that the image is re-sampled.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!