map_nyc = {
let container = DOM.element('div', {style: `width:${width}px;height:${width/1.6}px`});
yield container;
let map = L.map(container).setView([40.7608, -111.8910], 14);
let osmLayer = L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{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
}).addTo(map);
for (var i=0; i<slc_network.length; i++) {
L.polyline(slc_network[i], {color: "lightgray", opacity:1, weight:0.8}).addTo(map);
}
for (const [index, intersection] of Object.entries(slc_intersection)) {
function onMapClick(e) {
for (var k=0; k<intersection["geometry"].length; k++){
L.polyline(intersection["geometry"][k], {color: "green", opacity:1, weight:0.8}).addTo(map);
}
}
var customOptions = {'maxWidth': '500', 'className': 'custom'}
var customPopup = html`<html>
<style>
table, th, td {
border:1px solid black;
}
</style>
<body>
<h2>Intersection ${index}</h2>
<table style="width:100%">
<tr>
<th>Road</th>
<th>Angle</th>
<th>Length</th>
<th>Lane Count</th>
<th>Speed Limit</th>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
<p></p>
</body>
</html>`
L.circle(intersection["centroid"], 20, {color: "red"}).addTo(map).on("click", onMapClick).bindPopup(customPopup, customOptions);
}
map.on("zoomend")
}