Get Started with deck.gl and Mapbox
Demo
Source
<html>
<head>
<title>Get Started with deck.gl and Mapbox</title>
<script src="https://unpkg.com/deck.gl@^9.0.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' />
</head>
<body style="margin:0; width: 100vw; height: 100vh;"></body>
<script type="text/javascript">
const {DeckGL, ScatterplotLayer, TextLayer} = deck;
new DeckGL({
mapStyle: 'https://basemaps.cartocdn.com/gl/positron-nolabels-gl-style/style.json',
initialViewState: {
longitude: -122.45,
latitude: 37.78,
zoom: 11,
maxZoom: 16
},
controller: true,
layers: [
new ScatterplotLayer({
data: [
{position: [-122.402, 37.79], color: [255, 0, 0], radius: 1000}
],
getPosition: d => d.position,
getFillColor: d => d.color,
getRadius: d => d.radius,
opacity: 0.3
}),
new TextLayer({
data: [
{position: [-122.402, 37.79], text: 'Hello World'}
],
getPosition: d => d.position,
getText: d => d.text
})
]
});
</script>
</html>