Joint use Leaflet.draw and Leaflet.markercluster
See original GitHub issueWhen 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:
- Created 10 years ago
- Comments:11 (7 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
You will never be able to use Leaflet.Draw on a Leaflet.MarkerClusterGroup layer.