Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

123
Vistas
Getting Leaflet markercluster text / properties for cluster popup tooltips?

Following this tutorial on how to get custom tooltips on Leaflet.markercluster popups and I don't understand how the marker attributes are built with a.layer._markers[feat].feature.properties['name'], as I don't know how to refer to the relevant text / property in my code. Their eg, simplified:

markers.on('clusterclick', function(a){
            popUpText = '<ul>';
            for (feat in a.layer._markers){
                popUpText+= '<li>' + a.layer._markers[feat].feature.properties['name'] + '</li>';
            }
            popUpText += '</ul>';
            var popup = L.popup().setLatLng([a.layer._cLatLng.lat, a.layer._cLatLng.lng]).setContent(popUpText).openOn(map); 
        })

The browser shows "Uncaught TypeError: a.layer._markers[feat].feature is undefined", and this is the only time the tutorial refers to a.layer._markers[feat].feature.properties['name']. My code for non cluster popups:

var addressPoints = [
[36.942, 69.902, "a"],
[36.946, 69.911, "b"],
[36.943, 69.909, "c"],
]

for (var i = 0; i < addressPoints.length; i++) {
  var a = addressPoints[i];
  var title = a[2];
  var marker = L.marker(new L.LatLng(a[0], a[1]), {title: title});
  marker.bindPopup(a[2]);
  markers.addLayer(marker);
}

map.addLayer(markers);

I can't find it through seemingly any variation of a.layer_markers[whatever]. How can I adjust their example to get the equivalent a.layer._markers[feat].feature.properties['name'] from my markers? Or how can I troubleshoot this by finding the properties of a.layer_markers[whatever] to make the tooltip display "a", "b", or other properties provided in addressPoints?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda