map = function*(points, options, mapOptions = {}) {
const container = html`<div style="height:500px;">`;
const map = L.map(container, {
maxBounds: [[-100, -190], [100, 190]],
...mapOptions
});
yield container;
const renderer = L.canvas();
const cluster = L.featureGroup(points.map(m => marker(m, renderer))).addTo(
map
);
if (points.length > 0) map.fitBounds(cluster.getBounds());
if (options) {
map.setView(options.view, options.zoom);
}
L.tileLayer(
"https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png",
{
attribution:
'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors © <a href="https://carto.com/attributions">CARTO</a>',
subdomains: "abcd",
maxZoom: 19,
noWrap: true
}
).addTo(map);
container.value = map;
return container;
}