Search code examples
mapbox-gl-jsopenmaptilesdeck.gl

use openmaptiles.org base map style with Deck.gl


I am trying to use the non-proprietary basemap style from openmaptiles.org (https://openmaptiles.org/docs/website/mapbox-gl-js/) with Deck.gl. In my example I am using the 'Dark matter' style.

    deckgl = new deck.DeckGL({
        container,
        map: mapboxgl,
        mapboxApiAccessToken: mapboxAccessToken,
        // mapStyle: "mapbox://styles/mapbox/dark-v9",
        mapStyle:
          "https://openmaptiles.github.io/dark-matter-gl-style/style-cdn.json",
        longitude: -98.58,
        latitude: 39.82,
        zoom: 4
      });

When I run this code, I am getting this error 'Failed to load resource: the server responded with a status of 403 () [https://maps.tilehosting.com/data/v3.json?key=SymbVzXrAD6Jmqe6yBOS]'. What am I doing wrong here?

When I run this code with the mapbox style (commented out), it works fine.

Thanks Kiran


Solution

  • As you'll see when you go to that URL directly, tilehosting.com is telling you that you don't have the right API key to access that resource.