Published
Edited
Jul 11, 2019
1 fork
Insert cell
Insert cell
viewof map = {
const target = html`<div style="height:600px;">`;
yield target; // Give the container dimensions.
const map = target.value = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.Stamen({layer:"watercolor"}),
//source: new ol.source.OSM()
}),
new ol.layer.Tile({
source: new ol.source.Stamen({layer:"terrain-labels"})
})
],
target,
view: new ol.View({
center: ol.proj.fromLonLat([15.251571, 40.366664]),
zoom: 10
})
});
invalidation.then(() => map.dispose());
return target;
}
Insert cell
ol = {
// OpenLayers doesn’t publish a build to npm, so we can’t use unpkg. :(
const ol = await require("https://openlayers.org/en/v5.2.0/build/ol.js").catch(() => window.ol);
if (!ol.css) ol.css = document.head.appendChild(html`<link rel=stylesheet href="https://openlayers.org/en/v5.2.0/css/ol.css">`);
return ol;
}
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