全局地图图块消失,超出缩放级别19 [英] Global map tiles disappear past zoom level 19

查看:147
本文介绍了全局地图图块消失,超出缩放级别19的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将OpenStreetMap与 Leaflet.js 一起使用.

I use OpenStreetMap with Leaflet.js.

我有一张带有室内图片的地图.问题是当我放大时,街道消失了.你知道什么可以解决这个问题吗?技巧或提示!

I have a map with an indoor picture on it. The problem is when I zoom in, streets disapears. Do you know anything that can solve this plz? Tricks or tips!

编辑:

// Load the Map
this.map_ = L.map($(selector)[0], {
    center: [
      48.8459382,
      2.2863024,
    ],

    maxZoom: 24,
    zoom: 20,
});

推荐答案

我想您已经使用了 map.options.maxZoom ,以便用户放大以查看您的室内图像细节.

I guess you have used map.options.maxZoom at a high number to let the user zoom to see your indoor image details.

但是,在缩放级别19以后,OSM磁贴不可用,因此服务器返回404错误,并且您的磁贴被错误磁贴"(如果未指定,则只是一个灰色磁贴)替换.

However, OSM tiles are not available past zoom level 19, so the server returns 404 errors and your tiles are replaced by the Error Tile (or just a grey tile if not specified).

在这种情况下,您只需要在 Tile Layer 上使用这两个选项(一起)即可告诉Leaflet重新使用较低缩放比例的图块并进行扩展:

In that case, you would simply need to use these 2 options (together) on Tile Layer to tell Leaflet to re-use tiles from a lower zoom and to expand them:

  • maxNativeZoom set at 19.
  • maxZoom set at whatever you need, and equal to map.options.maxZoom if specified.
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
    maxNativeZoom: 19, // OSM max available zoom is at 19.
    maxZoom: 22 // Match the map maxZoom, or leave map.options.maxZoom undefined.
}).addTo(map);

演示: http://jsfiddle.net/ve2huzxw/68/

这篇关于全局地图图块消失,超出缩放级别19的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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