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

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