<small id='FfqU7'></small><noframes id='FfqU7'>

<tfoot id='FfqU7'></tfoot>
    • <bdo id='FfqU7'></bdo><ul id='FfqU7'></ul>
    1. <i id='FfqU7'><tr id='FfqU7'><dt id='FfqU7'><q id='FfqU7'><span id='FfqU7'><b id='FfqU7'><form id='FfqU7'><ins id='FfqU7'></ins><ul id='FfqU7'></ul><sub id='FfqU7'></sub></form><legend id='FfqU7'></legend><bdo id='FfqU7'><pre id='FfqU7'><center id='FfqU7'></center></pre></bdo></b><th id='FfqU7'></th></span></q></dt></tr></i><div id='FfqU7'><tfoot id='FfqU7'></tfoot><dl id='FfqU7'><fieldset id='FfqU7'></fieldset></dl></div>

      1. <legend id='FfqU7'><style id='FfqU7'><dir id='FfqU7'><q id='FfqU7'></q></dir></style></legend>

      2. 空白地图图块 - 错误 410 消失(Mapbox 和 Leaflet JS)

        时间:2023-05-28
        <tfoot id='dDcOY'></tfoot>
      3. <i id='dDcOY'><tr id='dDcOY'><dt id='dDcOY'><q id='dDcOY'><span id='dDcOY'><b id='dDcOY'><form id='dDcOY'><ins id='dDcOY'></ins><ul id='dDcOY'></ul><sub id='dDcOY'></sub></form><legend id='dDcOY'></legend><bdo id='dDcOY'><pre id='dDcOY'><center id='dDcOY'></center></pre></bdo></b><th id='dDcOY'></th></span></q></dt></tr></i><div id='dDcOY'><tfoot id='dDcOY'></tfoot><dl id='dDcOY'><fieldset id='dDcOY'></fieldset></dl></div>

        <small id='dDcOY'></small><noframes id='dDcOY'>

            <bdo id='dDcOY'></bdo><ul id='dDcOY'></ul>

              <tbody id='dDcOY'></tbody>
                <legend id='dDcOY'><style id='dDcOY'><dir id='dDcOY'><q id='dDcOY'></q></dir></style></legend>
                  本文介绍了空白地图图块 - 错误 410 消失(Mapbox 和 Leaflet JS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我正在使用 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:

                  GET https://api.tiles.mapbox.com/v4/mapbox.streets/9/123/183.png?access_token=pk.eyJ1IjoibXl2ZXJkaWN0IiwiYSI6ImNrZmoyYmpuNDB1eHYycG16bms0aHN2ZWwifQ.w0DRp5yDUHxa2RJa0aDRlQ 410 (Gone)
                  Image (async)       
                  createTile  @   TileLayer.js:158
                  _addTile    @   GridLayer.js:812
                  _update     @   GridLayer.js:709
                  _setView    @   GridLayer.js:570
                  _resetView  @   GridLayer.js:526
                   onAdd      @   GridLayer.js:162
                  _layerAdd   @   Layer.js:114
                  whenReady   @   Map.js:1465
                  addLayer    @   Layer.js:176
                  addTo       @   Layer.js:52
                  (anonymous) @   maps.js:16
                  

                  上面的 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:

                  let coordinates = [ 44.96, -93.2 ] 
                  let zoomLevel = 9
                  let map = L.map("college-map").setView(coordinates, zoomLevel)
                  
                  L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {
                  attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery &copy; <a href="https://www.mapbox.com/">Mapbox</a>',
                  id: 'mapbox.streets',
                  accessToken: 'your-access-token'
                  }).addTo(map)
                  

                  如何修复此错误并成功显示地图?

                  How do I fix this error and display the map successfully?

                  推荐答案

                  Mapbox 将 url 架构从:

                  Mapbox changed the url schema from:

                  var map = L.map('map');
                  
                  L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {
                      attribution: '© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a></strong>',
                      maxZoom: 18,
                      id: 'mapbox.streets',
                      accessToken: 'YOUR_MAPBOX_ACCESS_TOKEN'
                  }).addTo(map);
                  

                  收件人:

                  var map = L.map('map');
                  
                  L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
                      attribution: '© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a></strong>',
                      tileSize: 512,
                      maxZoom: 18,
                      zoomOffset: -1,
                      id: 'mapbox/streets-v11',
                      accessToken: 'YOUR_MAPBOX_ACCESS_TOKEN'
                  }).addTo(map);
                  

                  网址 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)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:单击 Leaflet Popup 中的链接并执行 Javascript 下一篇:函数事件(onChange)中的调用函数,来自在 Leaflet 和

                  相关文章

                  最新文章

                    <bdo id='4vcER'></bdo><ul id='4vcER'></ul>
                  <i id='4vcER'><tr id='4vcER'><dt id='4vcER'><q id='4vcER'><span id='4vcER'><b id='4vcER'><form id='4vcER'><ins id='4vcER'></ins><ul id='4vcER'></ul><sub id='4vcER'></sub></form><legend id='4vcER'></legend><bdo id='4vcER'><pre id='4vcER'><center id='4vcER'></center></pre></bdo></b><th id='4vcER'></th></span></q></dt></tr></i><div id='4vcER'><tfoot id='4vcER'></tfoot><dl id='4vcER'><fieldset id='4vcER'></fieldset></dl></div>
                  <tfoot id='4vcER'></tfoot>
                1. <legend id='4vcER'><style id='4vcER'><dir id='4vcER'><q id='4vcER'></q></dir></style></legend>

                      <small id='4vcER'></small><noframes id='4vcER'>