Published
Edited
Apr 3, 2021
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
ol = require('openlayers@4')
Insert cell
html`<link href='https://unpkg.com/openlayers@4.6.5/css/ol.css' rel='stylesheet' />`
Insert cell
Insert cell
Insert cell
Insert cell
map = {
let map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
target: html`<div style='height:500px;'></div>`,
view: new ol.View({
center: ol.proj.fromLonLat(center),
zoom: 7
})
});
setTimeout(() => map.updateSize(), 1);
return map;
}
Insert cell
Insert cell
Insert cell
vectorSource = {
var vectorSource = new ol.source.Vector();
var circleLayer = new ol.layer.Vector({
source: vectorSource
});
map.addLayer(circleLayer);
return vectorSource
}
Insert cell
{
data.forEach(({Count, Latitude, Longitude}) => {
Count = parseFloat(Count)
Latitude = parseFloat(Latitude)
Longitude = parseFloat(Longitude)
const radius = Count * 3000
const coord = ol.proj.fromLonLat([Longitude, Latitude])

vectorSource.addFeature(new ol.Feature(new ol.geom.Circle(coord, radius)))
})
}
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