map = {
let mapContainer = DOM.element('div', { style: `width:${width}px;height:${width/1.6}px` });
yield mapContainer;
let map = L.map(mapContainer).setView([34.1, -118.25], 10);
let osmLayer = L.tileLayer(
'https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png', {
attribution: '© <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors, © <a href=\"http://cartodb.com/attributions\">CartoDB</a>',
detectRetina: false,
maxZoom: 18,
minZoom: 10,
noWrap: false,
subdomains: 'abc'
}).addTo(map);
let schoolPoints = schools.features.map(feature =>
feature.geometry.coordinates.slice().reverse().concat([0.1]));
let schoolsHeatLayer = heatLayer(schoolPoints, {
minOpacity: 0.5,
maxZoom: 18,
max: 1.0,
radius: 8,
blur: 5,
gradient: null
}).addTo(map);
let markers = markerCluster({});
let schoolsLayer = L.geoJson(schools, {
onEachFeature: function (feature, layer) {
const school = feature.properties;
const html = `<div class="popup"><h2>${school.name}</h2>` +
`<p>${school.district} District</p><p>grades: ${school.grades_served}</p></div>`
layer.bindPopup(html);
layer.bindTooltip(`${school.name}, ${school.grades_served}`, {sticky: true});
}
});
markers.addLayer(schoolsLayer);
map.addLayer(markers);
fullScreen({
position: 'topright',
title: 'full screen',
titleCancel: 'exit full screen',
forceSeparateButton: true,
}).addTo(map);
map.on('enterFullscreen', function(){
console.log('entered fullscreen');
});
}