I am looking for ideas/libraries that enable snapping when I create a circle with leaflet draw. There is the libaray Leaflet snap, that enables snapping of draggable markers to polylines and other layers. But I am looking for an option to snap to markers when creating a circle. So basically create a circle around the marker.
enter image description here

1 Answer 1


Did you find a solution?

I've created a function which does this for me.

  function mapToPosition(position){
    lon = position.coords.longitude;
    lat = position.coords.latitude;

    var marker = new L.Marker([lat,lon],{title: "Not at the right spot? Drag me!"}).addTo(map);

    marker.on('dragend', function(e){
      var coords = e.target.getLatLng();
      var lat = coords.lat;
      var lon = coords.lng;
      cir = L.circle([lat,lon],1000).addTo(map).bindPopup("Area within 1km of your point.");

    cir = L.circle([lat,lon],1000).addTo(map);

I hope that helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.