Public
Edited
Feb 12, 2023
Importers
Insert cell
Insert cell
leafletMap = function* (geojson) {
if (!geojson.features.length) {
yield "Waiting for input";
return;
}
const container = DOM.element("div", {
style: `width:${width}px;height:${width / 1.6}px`
});
yield container;
const map = L.map(container);
const data = L.geoJson(geojson).addTo(map);
const osmLayer = L.tileLayer(
"https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}@2x.png"
).addTo(map);
map.fitBounds(data.getBounds());
}
Insert cell
L = require('leaflet')
Insert cell
style = html`<link href='${resolve(
"leaflet@1.2.0/dist/leaflet.css"
)}' rel='stylesheet' />`
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