Lealfet 1.0.0 Support - Editing/deleting doesn't work
See original GitHub issueShould I still use the Leaflet-master branch for 1.0.0? Because I’m experiencing some problems with it. the Leaflet-master branch seems to be stale as the last update was made 6 months ago… (!) It’s kinda confusing.
I’m using Leaflet 1.0.0-rc1. I can succesfully draw features and they are added to the map, however, once they are added, I cannot edit/delete them as modify/delete buttons are grayed out. No errors are given.
Here’s my code:
// Initialise the FeatureGroup to store editable layers
let drawnItems = new L.FeatureGroup();
this._map.addLayer(drawnItems);
// Initialise the draw control and pass it the FeatureGroup of editable layers
let drawControl = new L.Control.Draw({
draw: {
polyline: {
metric: true
},
polygon: {
allowIntersection: false,
showArea: true,
drawError: {
color: '#b00b00',
timeout: 1000
},
shapeOptions: {
color: '#bada55'
}
},
marker: false
},
edit: {
featureGroup: drawnItems
}
});
this._map.addControl(drawControl);
// Listen for editor events
this._map.on('draw:created', (e) => {
let type = e.layerType,
layer = e.layer;
this._map.addLayer(layer);
});
I also cannot remove the last point of the polyline.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Leaflet Marker not found production env - Stack Overflow
This is a known bug in Leaflet, the root issue is that Leaflet's icon image location is been wrongly referenced during bundling.
Read more >Documentation - a JavaScript library for interactive maps
L.SVG or L.Canvas by default depending on browser support. ... Creates a new map pane with the given name if it doesn't exist...
Read more >leaflet.extras.pdf
Used for adding shapes(markers, lines, polygons) and then editing them using the draw plugin. You can either set layerId or group or none...
Read more >Read Leaflet Tips and Tricks | Leanpub
These contributors also deserve honours for the work on leaflet.js. ... circles and markers to a map and then edit or delete those...
Read more >Create, Edit, Delete Geometrics | Leaflet-Draw Plugin | GeoDev
Tutorial Code: https://github.com/iamtekson/ Leaflet -Basic/tree/master/drawLeaflet ... Leaflet Draw Polygon | Create, Edit, Delete Geometrics ...
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
I apologize for the confusion, Leaflet.Draw has not been updated for 1.0 support yet, however it is planned.
@gholol I think your problem is that you have to add editable items to the
drawnItems
layer. That can be fixed in your ‘draw:created’ handler.I ran into the same problem when I started.
That doesn’t mean editing works in 1.0.0 though… you will still run into issues once the buttons become clickable 😦