卫星瓦片源不工作

时间:2016-02-17 15:58:03

标签: mapbox-gl-js

https://www.mapbox.com/mapbox-gl-style-spec/#sources-raster

这导致黑色瓷砖没有错误信息,我不明白为什么?

var style = {
            "version": 8,
            "sprite": "mapbox://sprites/mapbox/bright-v8",
            "glyphs": "mapbox://fonts/mapbox/{fontstack}/{range}.pbf",
            "sources": {
                "mapbox-satellite": {
                    "type": "raster",
                    "url": "mapbox://mapbox.satellite",
                    "tileSize": 256
                }
            },
            "layers": [{
                "id": "new-layer",
                "type": "background",
                "paint": {"background-color": "#111"},
                "interactive": true
            }],
        }

mapboxgl.accessToken = ...
var map = new mapboxgl.Map({
    container: 'map',
    style: style, 
    //style: 'mapbox://styles/mapbox/satellite-v8',
    center: [4.7095, 52.0393],
    zoom: 9, 
    hash: true
});

1 个答案:

答案 0 :(得分:2)

看起来您只添加了栅格。如果要在地图上绘制卫星图块,还必须添加使用栅格源的栅格图层。见https://www.mapbox.com/mapbox-gl-style-spec/#layers-raster