Skip to main content

Questions tagged [leaflet.draw]

Vector drawing and editing plugin for Leaflet

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 ...
Sam's user avatar
  • 900
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 ...
codejunkie's user avatar
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 ...
Tom's user avatar
  • 117
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....
Moon123's user avatar
  • 153
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 ...
Ground Hog's user avatar
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 ...
Chronix3's user avatar
  • 621
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 ...
Vaisakh Rajagopal's user avatar
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, ...
Petr Bečka's user avatar
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 ...
roberrrt-s's user avatar
  • 8,140
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 ...
Jonathan's user avatar
  • 633
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.
codejunkie's user avatar
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 ...
Marcus Junius Brutus's user avatar
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 ...
aclowkay's user avatar
  • 3,787
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 ...
jduhls's user avatar
  • 693
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?
Romina's user avatar
  • 315

15 30 50 per page