Published
Edited
Mar 3, 2018
Insert cell
Insert cell
Insert cell
L = require('leaflet')
Insert cell
carto = require('carto.js')
Insert cell
html`<link href='${resolve('leaflet/dist/leaflet.css')}' rel='stylesheet' />`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
map = {
// See tmcw example for details
let container = DOM.element('div', { style: `width:${width}px;height:${width/3}px` });
yield container;
// Now we create a map object and add a layer to it.
let map = L.map(container).setView([30, 0], 3);
L.tileLayer('https://{s}.basemaps.cartocdn.com/rastertiles/voyager_nolabels/{z}/{x}/{y}.png', {
maxZoom: 18
}).addTo(map);
const client = new carto.Client({
apiKey: 'YOUR_API_KEY',
username: 'cartojs-test'
});

client.addLayer(
new carto.layer.Layer(
new carto.source.Dataset(table_name),
new carto.style.CartoCSS(cartoCSS)
));
client.getLeafletLayer().addTo(map)
}
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