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

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more