deck.gl BitmapLayer Example

Demo

Source

<html>
  <head>
    <title>deck.gl BitmapLayer Example</title>

    <script src="https://unpkg.com/deck.gl@^8.8.0/dist.min.js"></script>
    <script src='https://unpkg.com/maplibre-gl@3.6.0/dist/maplibre-gl.js'></script>

    <link href='https://unpkg.com/maplibre-gl@3.6.0/dist/maplibre-gl.css' rel='stylesheet' />
    <style type="text/css">
      body {
        width: 100vw;
        height: 100vh;
        margin: 0;
      }
    </style>
  </head>

  <body></body>

  <script type="text/javascript">
    const {DeckGL, BitmapLayer} = deck;
    
    // MapBox example : https://docs.mapbox.com/mapbox-gl-js/example/image-on-a-map/
    new DeckGL({
      mapStyle: 'https://basemaps.cartocdn.com/gl/dark-matter-nolabels-gl-style/style.json',
      initialViewState: {
        longitude: -75.789,
        latitude: 41.874,
        zoom: 5,
        maxZoom: 9
      },
      controller: true,
      layers: [
        new BitmapLayer({
          id: 'bitmap-layer',
          bounds: [
            [-80.425, 37.936],
            [-80.425, 46.437],
            [-71.516, 46.437],
            [-71.516, 37.936]
          ],
          image: 'https://docs.mapbox.com/mapbox-gl-js/assets/radar.gif'
        })
      ]
    });
    
  </script>
</html>