JSFiddle - React, Tailwind, and code Playground

by Tristen Brown

HTML

<link rel="stylesheet" href="https://api.mapbox.com/mapbox-assembly/mbx/v1.2.0/assembly.min.css">
<link rel="stylesheet" href="https://api.mapbox.com/mapbox-gl-js/v3.1.2/mapbox-gl.css">
<script src="https://labs.mapbox.com/standard-style/versions/mapbox-gl-dev-v3.3.0-alpha.2.js"></script>
<div id="map" class="absolute top bottom left right w-full"></div>

JavaScript

mapboxgl.accessToken = 'pk.eyJ1IjoibWFwYm94c2F0ZWxsaXRlIiwiYSI6ImNqZWZ0MHg0djFqZWoyeG9kN3ZiMmkyd3cifQ.y2HNjGo7FcKQ7psI_BfGqQ';

const style = {
  "version": 8,
  "center": [135, 27],
  "zoom": 2,
  "sources": {
    "rasterarray": {
      "url": "mapbox://mapboxsatellite.nowc-test-vec03",
      "type": "raster-array"
    }
  },
  "glyphs": "mapbox://fonts/mapbox/{fontstack}/{range}.pbf",
  "projection": {
    "name": "globe"
  },
  "layers": [{
      "id": "background",
      "type": "background"
    },
    {
      "id": "temperature",
      "type": "raster",
      "source": "rasterarray",
      "source-layer": "precipitation"
      
    }
  ]
};

const map = new mapboxgl.Map({
  container: 'map',
  style
});