Public
Edited
Sep 7, 2023
Insert cell
Insert cell
viewof accessToken = Inputs.text({
label: "Access token",
value: "pk.eyJ1IjoicmVkZXNpZ25pbmciLCJhIjoiY2t2NmdmbGZzMTd2ODJubHVqcmQ1bXcxMiJ9.3_k3e6aGsBFN_fKBIoLQ9g"
})
Insert cell
viewof myMap = {
const container = html`<div id='map' class='bg-gray-dark w-full h600'></div>`;
const map = new mapboxgl.Map({
container,
center: [-71.057083, 42.361145],
zoom: 15.5,
pitch: 75
});

invalidation.then(() => map.remove());

map.addControl(new mapboxgl.FullscreenControl());
container.value = map;

return container
}
Insert cell
mapboxgl = {
const gl = await require("https://api.mapbox.com/mapbox-gl-js/v3.0.0-beta.2/mapbox-gl.js");
if (!gl.accessToken) {
gl.accessToken = accessToken;
const href = await require.resolve("mapbox-gl@3.0.0-beta.2/dist/mapbox-gl.css");
document.head.appendChild(html`<link href=${href} rel=stylesheet>`);
}
return gl;
}
Insert cell
html`<link href="https://api.mapbox.com/mapbox-assembly/mbx/v1.2.0/assembly.css" rel="stylesheet" />`
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more