Creé un mapa en Leaflet y tengo datos de GeoJSON . Agregué mis datos a mi mapa. Pero en el mapa, solo hay puntos sin información cuando hago clic en ellos. Traté de agregar use esto :
var marker = L.marker([51.5, -0.09]).addTo(map); marker.bindPopup("<b>Hello world!</b><br>I am a popup.").openPopup();Pero tampoco funcionó. Alguien me puede ayudar en esto ?
Debe vincular la ventana emergente con información al crear la capa GeoJSON:
L.geoJSON(data, { onEachFeature: function (feature, layer) { // does this feature have a property named popupContent? if (feature.properties && feature.properties.popupContent) { layer.bindPopup(feature.properties.popupContent); } } }).addTo(map);Busque más información en el Tutorial de GeoJSON