What can we help you with?

e.g. Getting Started, Build Dashboards

Custom Click handler for Marker click on a Geo Cluster map

1 comment

  • Official comment
    Avatar
    Jay

    In the custom Javascript handler, you can retrieve the markers and apply an on click event handling. Example below draws a circle with a radius of 1000 meters for a clicked point:

     

    map.eachLayer(function (layer) { 
          if (layer instanceof L.Marker){
               layer.on("click", function (event) {
                   var clickedMarker = event.layer;
                   L.circle( event.latlng, {radius: 1000}).addTo(map);
               });
          }
    });
     
     
    Comment actions Permalink

Please sign in to leave a comment.