question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Joint use Leaflet.draw and Leaflet.markercluster

See original GitHub issue

When cluster reopen, draw crash

  var editableLayers = new L.MarkerClusterGroup({maxClusterRadius: 50});

  map.addLayer(editableLayers); 

  var drawControl = new L.Control.Draw({
    draw: {
      position: 'topleft',
      polyline: false,
      polygon: false,
      rectangle: false,
      circle: false,
      marker: {
        repeatMode: true
      }
    },
    edit: {
      featureGroup: editableLayers
    },

  });

  map.addControl(drawControl);

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
danzelcommented, Apr 25, 2015

Most people use another layer for editing, then transfer the markers to the cluster layer when editing is done.

We use a separate layer for adding markers, then when toggling moving a marker we remove it from the MCG and put it on the map to move it. Markers can be directly removed from a MCG.

1reaction
danzelcommented, Apr 22, 2015

You will never be able to use Leaflet.Draw on a Leaflet.MarkerClusterGroup layer.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Leaflet.markercluster | Marker Clustering plugin for Leaflet
Provides Beautiful Animated Marker Clustering functionality for Leaflet, a JS library for interactive maps. Requires Leaflet 1.0.0. cluster map example. For a ...
Read more >
Marker Clustering and Customizing Using Leaflet.js
This blog will let you know to customize the clusters of markers using Leaflet.js. Prerequisites are Leaflet.js library.
Read more >
Using Leaflet plugins with MapBox.js: A Showcase
Using Leaflet plugins with MapBox.js: A Showcase · Leaflet.draw · Leaflet.markercluster · Leaflet-MiniMap · Leaflet-hash and Leaflet.fullscreen.
Read more >
Leaflet clustermarker with custom icon - Stack Overflow
Using the example here: https://github.com/Leaflet/Leaflet.markercluster/blob/master/example/marker-clustering-custom.html.
Read more >
Adding the draw control in Leaflet - GIS Stack Exchange
The question was kindly answered on another forum. Here's the reply: Leaflet.draw requires Leaflet master. This is because the controls have ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found