function addPopup(feature, layer) { var popupContent = feature.properties.name; layer.bindPopup(popupContent); layer.on('mouseover', function (e) { this.openPopup(e.latlng); }); layer.on('mouseout', function (e) { this.closePopup(); }); }