{ if (map) { map.setStyle(basemaps[id]); } }} />
{ if (map) { if (checked) { if (!map.getSource(id)) { map.addSource(id, overlays[id]); } map.addLayer({ id, type: overlays[id].type === 'raster' ? 'raster' : 'line', source: id, paint: { ...(id in opacities ? overlays[id].type === 'raster' ? { 'raster-opacity': opacities[id] } : { 'line-opacity': opacities[id] } : {}) } }); } else { map.removeLayer(id); } } }} />