Questions tagged [leaflet.draw]
Vector drawing and editing plugin for Leaflet
leaflet.draw
27
questions
47
votes
4
answers
35k
views
Leaflet.draw mapping: How to initiate the draw function without toolbar?
For anyone experienced with leaflet or leaflet.draw plugin:
I want to initiate drawing a polygon without using the toolbar from leaflet.draw. I've managed to find the property that allows editing ...
7
votes
2
answers
17k
views
Add existing leaflet polygons to an existing leaflet layer
I have a bunch of polygons which are stored in a database. I would like to add them to the map in such a way that they can be edited using the leaflet-draw toolbar. Although, now the polygons get ...
4
votes
2
answers
9k
views
Leaflet Draw "Cannot read property 'enable' of undefined" adding control to geoJSON layer
I am trying to use leaflet's edit function on polygons that I loaded from my database. When I click on leaflet's edit button I get the error
Cannot read property 'enable' of undefined
This thread ...
2
votes
1
answer
8k
views
update properties of geojson to use it with leaflet
I have a requirement of using leaflet.js to add a map to my site. The site has an administration view where an admin can add markers and add description and image to each marker.
I used the leaflet....
10
votes
1
answer
16k
views
How to click a button and start a new polygon without using the Leaflet.draw UI
What I'm struggling with is how to click a button and start a new polygon without using the Leaflet.draw UI. e.g.
$('#draw_poly').click(function() {
});
I'm able to put an existing polygon into ...
7
votes
3
answers
4k
views
Leaflet Draw not taking properties when converting FeatureGroup to GeoJson
I'm unable to convert my Layer properties into the properties of the GEOJson object using Leaflet(0.7.7)/Leaflet.Draw(latest). My workflow is:
1 Create Map: var map = L.map('#map', options);
2 ...
5
votes
1
answer
5k
views
ngx-leaflet-draw: Importing module which does not have a ɵmod property
Importing LeafletDrawModule which does not have a ɵmod property
I am seeing this error during my unit testing(jest).
The code works fine when I run the ng application. Leaflet draw function works ...
1
vote
3
answers
6k
views
rotate polygon around point in leaflet map
I have an issue, in my leaflet map I've created a triangle from polygon:
var polygon = L.polygon([
[parseFloat(decimal_lat),parseFloat(decimal_lon)],
[parseFloat(decimal_lat) + 1, ...
11
votes
3
answers
15k
views
How can I grab a selection of markers with Leaflet.draw?
Context:
I've made a map, and populated it with around 300 random markers. I can 'select' the markers by clicking on a link in the popup and activate a selection to display data from. I also have the ...
8
votes
2
answers
9k
views
leaflet-draw delete button remove "clear all" action
How can I remove the "clear all" action from the delete button in the leaflet-draw edit toolbar?
I know you can remove the whole delete button but still need to remove individual items.
Basically ...
2
votes
2
answers
5k
views
Disable leaflet-draw "delete" button
How can I disable/remove the delete button in the leaflet-draw edit toolbar?
The "edit" button should remain enabled.
0
votes
1
answer
4k
views
how to calculate area of polygon using Leaflet.Draw GeometryUtil
I read this answer on how to calculate the area of a polygon and I am trying to achieve the same. However, I consistently get 0 (zero) for the area.
JS fiddle is here.
The crux of my code is:
var ...
9
votes
4
answers
11k
views
Property 'Draw' does not exist on type 'typeof Control'
I'm attempting to implement a map component with leaflet and other leaflet plugins. The issue is other plugins don't work from TypeScript for some reason.
For example I'm unable to compile code with ...
7
votes
3
answers
6k
views
leaflet.draw trash button delete all polygons and save
Using javascript, how can I alter the leaflet.draw "Trash" button to delete all polygons that have been drawn and automatically save. Below is the code I've implemented but it is a complete hack. It ...
5
votes
1
answer
11k
views
Leaflet draw edit control custom text
I'd like to change the options text from edit control at Leaflet Draw. So instead of Save|Cancel|Clear All Display this text in another language. Same on the tooltips. Is it possible?