簡體   English   中英

MapBox-GL Source / addSource錯誤

[英]MapBox-GL Source / addSource bug

我收到此錯誤**Uncaught TypeError: Cannot read property 'sources' of undefined**嘗試將圖塊加載為mapbox-gl源時**Uncaught TypeError: Cannot read property 'sources' of undefined** (mapbox-gl.js:4)。

<div id='map' style='height:500px;width:700px;'>    
</div>

<script>
    var accessToken='<my access token>'
    mapboxgl.accessToken = accessToken;
    var map = new mapboxgl.Map({
      container: 'map',
      style: 'https://www.mapbox.com/mapbox-gl-styles/styles/outdoors-v4.json', //stylesheet location
      center: [-34.6, -58.4],
      zoom: 11
    });
    var sourceObj = new mapboxgl.Source({
      type: 'vector',
      url: 'mapbox://<some map id>'
    });
    map.addSource('test',sourceObj);
</script>

如果我不加載任何源,則一切正常。 在API的0.2.10.2.2版本中會發生這種情況。 我嘗試使用不同的圖塊,但遇到了相同的問題。

有什么線索嗎?

提前致謝

這是Mapbox GL中的錯誤 ,我們將修復。 感謝您的報告。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM