Public
Edited
Oct 14, 2024
1 fork
Insert cell
Insert cell
mapboxgl = await require("mapbox-gl@0.49");
Insert cell
// TODO: Add access token
mapboxgl.accessToken = "YOUR_ACCESS_TOKEN"
Insert cell
container = html`<div style='height:900px;' />`;
Insert cell
map = new mapboxgl.Map({
container: container,
// See all styles here: https://docs.mapbox.com/api/maps/styles/
style: "mapbox://styles/mapbox/light-v9",
zoom: 9.7,
center: [-122.2605, 37.5371],
interactive: false
});
Insert cell
{
// TODO: ADD CODE HERE

const data = d3.csv("FILE_URL_HERE",
(d) => {
// TODO: Add any data pre-processing here, if necesary
return d;
}
)

// This function projects the coordinates onto x, y values on the map
function project(d) {
return map.project(new mapboxgl.LngLat(d[0], d[1]));
}
}
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