空白地图图块 - 错误 410 消失(Mapbox 和 Leaflet JS)
问题描述
我正在使用 Leaflet JS 和 MapBox 创建地图.我的浏览器显示如下:
I am using Leaflet JS and MapBox to create a map. My browser displays as below:
地图根本不显示,我的地图图块是空白的.我在开发工具控制台中遇到的错误是:
The map does not show at all, my map tile is blank. The errors that I get in the dev tools console is:
上面的 maps.js:16
引用了下面 maps.js
代码片段中的最后一行 .addTo(map)
:
The maps.js:16
above references the last line .addTo(map)
in the maps.js
code snippet below:
如何修复此错误并成功显示地图?
How do I fix this error and display the map successfully?
推荐答案
Mapbox 将 url 架构从:
Mapbox changed the url schema from:
收件人:
网址 https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}
和{id: 'mapbox/streets-v11'}
已更改.
文档:Mapbox Leaflet Implementaton (右侧是一个带有 before 和 after(now) 的开关).
Doc: Mapbox Leaflet Implementaton (On the right side is a switch with before and after(now)).
网址参数:静态瓷砖样式
默认样式
新的默认样式ID:
- mapbox/streets-v11
- mapbox/outdoors-v11
- mapbox/light-v10
- mapbox/dark-v10
- mapbox/satellite-v9
- mapbox/satellite-streets-v11
这篇关于空白地图图块 - 错误 410 消失(Mapbox 和 Leaflet JS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!