我将 OpenStreetMap 与
<小时>编辑:
//加载地图this.map_ = L.map($(selector)[0], {中央: [48.8459382,2.2863024,],最大缩放:24,缩放:20,});我猜你用过map.options.maxZoom 设置为高数字,让用户缩放以查看您的室内图像细节.
但是,OSM 磁贴在缩放级别 19 之后不可用,因此服务器返回 404 错误,并且您的磁贴被错误磁贴替换(或者如果未指定,则只是灰色磁贴).
在这种情况下,您只需在 Tile Layer 上使用这 2 个选项(一起)来告诉 Leaflet 重新使用较低缩放比例的图块并展开它们:
maxNativeZoom 设置为 19.maxZoom 设置为您需要的任何值,并且相等到 map.options.maxZoom 如果指定.L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png',{maxNativeZoom: 19,//OSM 最大可用缩放为 19.maxZoom: 22//匹配地图 maxZoom,或者不定义 map.options.maxZoom.}).addTo(地图);演示:http://jsfiddle.net/ve2huzxw/68/
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!
EDIT:
// Load the Map
this.map_ = L.map($(selector)[0], {
center: [
48.8459382,
2.2863024,
],
maxZoom: 24,
zoom: 20,
});
I guess you have used map.options.maxZoom at a high number to let the user zoom to see your indoor image details.
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).
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);
Demo: http://jsfiddle.net/ve2huzxw/68/
这篇关于全球地图图块在缩放级别 19 后消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
检查一个多边形点是否在传单中的另一个内部Check if a polygon point is inside another in leaflet(检查一个多边形点是否在传单中的另一个内部)
更改传单标记群集图标颜色,继承其余默认 CSSChanging leaflet markercluster icon color, inheriting the rest of the default CSS properties(更改传单标记群集图标颜色,继承其余默认
触发点击传单标记Trigger click on leaflet marker(触发点击传单标记)
如何更改 LeafletJS 中的默认加载磁贴颜色?How can I change the default loading tile color in LeafletJS?(如何更改 LeafletJS 中的默认加载磁贴颜色?)
将外部geojson添加到传单层Add external geojson to leaflet layer(将外部geojson添加到传单层)
将 Leaflet 图层控件添加到侧边栏Adding Leaflet layer control to sidebar(将 Leaflet 图层控件添加到侧边栏)