Questions tagged [leaflet.draw]
Vector drawing and editing plugin for Leaflet
leaflet.draw
343
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 ...
23
votes
4
answers
33k
views
Coordinates of Leaflet.Draw rectangle
Is it possible to get the coordinates of the rectangle on mouseClick, so I have all the corners of the rectangle?
22
votes
5
answers
29k
views
TypeError: L.Control.Draw is not a constructor
I wanted to draw a polygon in the leaflet map in my ionic2 app, for that I found leaflet-draw pluggin, but I am getting this error
TypeError: L.Control.Draw is not a constructor
My code looks this
...
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 ...
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 ...
10
votes
1
answer
3k
views
React leaflet draw - marker icon and drag handler is missing
I am using react leaflet draw for drawing polygons and circles.
But when I chose edit polygon there is no drag handler for a move and resize.
How to solve this issue if any one have the same?
This ...
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 ...
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 ...
7
votes
3
answers
4k
views
Leaflet Draw on rectangle draw it throws error
I'm using leaflet + leaflet-draw + @ngx-leaflet + @ngx-leaflet-draw in an Angular application.
I've tried everything, versions change, importing the modules .forRoot() and not, adding the js files ...
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 ...
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 ...
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 ...
7
votes
2
answers
3k
views
Leaflet-Draw: Get polygon latLng in 'draw:editvertex' event
When a draw:editvertex event fires, how can I get information about the polygon which triggered it?
this.map.on('draw:editvertex', function (e) { debugger;
var layers = e.layers;
// I want to ...
7
votes
0
answers
3k
views
React Leaflet.draw: How to create draw functions with standard buttons without using the react-leaflet toolbar, however, have it written in "React"
how can I create custom buttons that reside on a leaflet map in a separate control box to create "Polylines", "Polygons" or a "Marker" which will all be on separate ...
6
votes
2
answers
15k
views
How to use leaflet "openstreetmap" with flutter?
I need help to integrate leaflet maps in flutter. The project I'm working on requires showing custom markers, animations, routes and drawings on the map. But I can't find any documentation or ...