Gert Cuykens
Gert Cuykens

Reputation: 7155

satellite tile source not working

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

This results in black tiles without error message, I have no idea why?

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
});

Upvotes: 0

Views: 350

Answers (1)

Lucas Wojciechowski
Lucas Wojciechowski

Reputation: 3802

It looks like you've only added the raster source. If you want the satellite tiles to be drawn on your map, you must also add a raster layer which uses the raster source. See https://www.mapbox.com/mapbox-gl-style-spec/#layers-raster

Upvotes: 2

Related Questions