');
popup.append('
');
var closer = jQuery('');
popup.append(closer);
/**
* Create an overlay to anchor the popup to the map.
*/
var overlay = new ol.Overlay({
element: popup.get(0),
autoPan: true,
autoPanAnimation: {
duration: 250
}
});
map.addOverlay(overlay);
/**
* Add a click handler to hide the overlay.
* @return {boolean} Don't follow the href.
*/
closer.click(function(e) {
overlay.setPosition(undefined);
e.target.blur();
return false;
});
function updateInfoBox(overlay, event) {
var map = event.map;
var pixel = map.getEventPixel(event.originalEvent);
var features = map.getFeaturesAtPixel(pixel, {hitTolerance: 20}) || [];
if (overlay && features.length) {
var feature = features[0];
var content = jQuery(overlay.getElement()).find('.popup-content');
const id = feature.get('id');