Questions tagged [leaflet-draw]

A plugin for Leaflet that adds support for drawing and editing vectors and markers on Leaflet maps.

Filter by
Sorted by
Tagged with
1
vote
0answers
21 views

Leaflet Drawing tools not displayed

I'm new with Leaflet and I'm facing some challenge with the toolbar. Below is my code: // ********* Map Initialization **************** mymap = L.map('mapdiv', {center:[12.10, 15.03], zoom:11, ...
1
vote
0answers
20 views

Remove a Drawn Polyline from LeafLet Map

How can I simply just remove this polyline from the map? var pointA = L.latLng(From.lat, From.lng); var pointB = L.latLng(To.lat, To.lng); var pointList ...
0
votes
1answer
27 views

Overlay with the feature collection properties

I have the GeoJSON: [{"type":"FeatureCollection", "features":[ {"type":"Feature","properties":{"id":27,"name":"F001"},"geometry":{"type":"LineString","coordinates":[[-100.231018,47....
0
votes
1answer
34 views

Checking if a specific leaflet.draw control is enabled?

Where exactly are the leaflet controls stored that are added to the map? So at anytime in the app, I can check something like if(controls.polyline.enabled==true) My guess is its somewhere in the map....
0
votes
1answer
37 views

Custom functions for SAVE and CANCEL on Leaflet.draw edit control

I have added an edit control on my map which is working fine (On the Frontend); var editControls = new L.Control.Draw({ draw: false, edit: { featureGroup: this.updateGeomLyr ...
1
vote
1answer
84 views

Cutting holes in custom polygon made with Leaflet.Draw

I would like to be able to create holes in polygons made with Leaflet.Draw plugin. For example, I currently have code like this: https://jsfiddle.net/4gkrfu5b/ If you draw a polygon on top of another ...
0
votes
1answer
45 views

Leaflet.Draw save coordinates

I'd like to save the polyline coordinates. I'm creating it with Leaflet.Draw. The problem is that the coordinates are stored twice. 49.907018,16.324997,49.907018,16.324997,49.818936,16.340103,49....
0
votes
0answers
86 views

Create a custom draw Toolbar

I would like to create my own custom toolbar for leaflet.draw plugin but I don't know how to approach this solution. To be more clear, I am trying to create a side-panel with buttons for each action, ...
3
votes
1answer
124 views

Prevent user from drawing a feature with Leaflet.draw

In my application using Leaflet.draw the user can set point markers on a map. I would like to allow the setting only in a certain area. The function isMarkerInsidePolygon(marker, polygon) returns ...
0
votes
0answers
45 views

Creating a Leaflet Overlay from JSON

I am trying to make an interactive map using leaflet where the user can toggle an overlay of multi-polygons. So far the following code works using a checkbox to display dummy point data, and radio ...
0
votes
0answers
106 views

Leaflet draw: prevent drawing through a custom overlay

I have a leaflet draw implementation (in Angular) with a custom sidebar that overlaps the Map. It should not be possible to draw through that sidebar. For circlemarkers I could solve this problem ...
0
votes
0answers
216 views

Pushing features to external GeoJSON file

I am working on a project which uses Leaflet and leaflet.draw to show and draw shapes on the map. I also have a data.json file which I use to display former features generated from geojson.io. What I ...
0
votes
1answer
329 views

Allowing users to add data to marker that they create on Leaflet map?

I have created a basic web map and implemented leaflet.draw functionality to it. What I would like to do is allow anyone that visits the web map to use the draw tools to add a marker (point) and when ...
-1
votes
1answer
136 views

Finding precision of polygon in Leaflet? [duplicate]

In order to convert coordinates to geohash I need to know the precision as well but unable to figure how to do so.. Any suggestions? ** EDIT ** What I try to do is to find the precision in leaflet ...
0
votes
0answers
33 views

Attach Textarea to Leaflet Draw Rectangle to drag with rectangle

I am trying to revive some of the code of Leaflet-Illustrate: It uses some Leaflet code that I believe is attaching hooks by using this: statics: { START: L.Draggable.START, END: L....
0
votes
1answer
87 views

How to repeat drawing function in Leaflet

I am trying to create a Leaflet.js web map that gives users the opportunity to draw lines. this line will be sent to mapquest elevation API to be retun to the map as a GeoJSON with elevation data ...
0
votes
0answers
101 views

Editing attributes of a GeoJSON in Leaflet

I have a map in which I'm trying to create the capabilities of adding new features and editing attributes of new and existing features. I have managed to make the feature editable but I want people to ...
0
votes
0answers
15 views

Which tool to use in order to create map? [duplicate]

What I am trying to do is to build a website with some maps for areas for a certain PC game. I just don't know where to start. How does one create a map? Do I need first to acquire a background ...
2
votes
0answers
93 views

Use leaflet-draw-toolbar with angular 2

Is it possible to use leaflet-draw-toolbar with angular 2 and ngx-leaflet-draw? I do not see, and I am not versed in Angular 2, enough, to incorporate the JS library for leaflet-draw-toolbar into my ...
1
vote
1answer
321 views

Leaflet: get layer in GeoJSON with pixel coordinates instead of lat long coordinates

In my Angular 7 project with ngx-leaflet and leaflet 1.4.0 and leaflet-draw 0.4.14 I want to export each drawn rectangle (and circle,...) to GeoJSON. That works fine using public onDrawCreated(e: ...
3
votes
0answers
68 views

Function fires despite conditional query in leaflet-map

In a map built with Leaflet I created a button to export and download data as geoJSON drawn before by the user with Leaflet.draw. To prevent an empty download, I am querying the existence of data. ...
2
votes
1answer
522 views

ipyleaflet draws?

If I draw a circle with map control in a map, how can I store in a variable? from ipyleaflet import Map, basemaps, basemap_to_tiles, DrawControl watercolor = basemap_to_tiles(basemaps.Stamen....
1
vote
1answer
392 views

Creating popup forms with Leaflet (L.Draw). How to implement listeners for radio buttons and other input groups?

I am attempting to create a map-based survey using Leaflet popups and specifically L.Draw, because I want users to be able to insert markers where ever they want to and then answer certain questions. ...
1
vote
0answers
292 views

How to change the layer selection view from Radio button to Image in Leaflet

I have implemented the below example to show the multiple base layers of map in my application using LeafletJs. Leaflet JS LayerGroup example I'm able to successfully implement the same but I'm ...
0
votes
1answer
949 views

How to highlight marker dynamically with leaflet and leaflet draw

I am trying to make a selection via drawing a rectangle (or any shape) with leaflet draw. The selected features should be highlighted. I saw that there are various functions within the leaflet source ...
2
votes
1answer
372 views

Revert a Leaflet.draw edit event

I'm trying to prevent a user in edit mode from creating overlapping shapes. With a CREATED event, I can easily remove the layer. But I want to revert an edited shape back to its original position ...
0
votes
2answers
314 views

Updating popup of a Leaflet Polygon

I am trying to update a popup for a polygon that I have drawn with Leaflet.Draw. Now I understand that to set a popup to a layer I just created, it's all fine. I can also get the id of that layer I ...
2
votes
2answers
530 views

Leaflet popup disappear or moved over drawn polygon

If I would like to popup something over an actually drawn polygon, then it sometimes disappear or moved to the first point of the polygon. https://jsfiddle.net/o149mgwj/19/ var drawnItems = new L....
1
vote
0answers
377 views

Leaflet Draw: edit/delete features of different layers

I use Leaflet Draw and Leaflet WFST plugins to create/edit features and save my edits to PostGIS Database (hosted by GeoServer). I have three layers: points, lines, and polygons. I manage to make new ...
1
vote
1answer
3k views

Entering manual coordinates to draw polygon in Leaflet?

I want the user to enter manual coordinates of a polygon and then to click on a button to draw the polygon. My code: <body> <div> Polygon: <input type="text" name="...
1
vote
0answers
787 views

Show marker only in area polygon [closed]

I got task, to plot polygon on map. After finish draw only marker inside a polygon appear on map. I'm done with leaflet.draw and Draw.Event.Created. What method I can use to check which marker inside ...
0
votes
2answers
4k views

How to get the exact Circle that user has drawn using Leaflet.draw.Circle?

I have a simple Leaflet map, where The user can draw a Circle, using Leaflet.Draw. When you use the following code to get the geometry, map.on(L.Draw.Event.CREATED, function (event) { var ...
3
votes
1answer
2k views

Get the lat/lng values of lines, polygons drawn by Leaflet drawing tools

I am new to JavaScript and Leaflet too. I made a basic map in Leaflet. I have also floated one sample geojson file in it. Now I also want leaflet for sourcing(co-ordinates) to my PHP file. So I need ...
0
votes
1answer
129 views

Leaflet draw - adding actions to prefilled markers

There are a bunch of markers which need to be loaded by default. The user can edit these markers and their corresponding properties in the popup window. The user can also add new markers and fill in ...
2
votes
1answer
366 views

How to use Draw.js in a Leaflet offline map

I'm trying to build a data-collecting map using Leaflet. To do this I have to download the Leaflet JavaScript files but I can't find out how to download a working draw.js. When I download draw.js I ...
2
votes
1answer
711 views

Leaflet.Draw - GeoJSON to KML

I have made a map using the Leaflet Draw plugin which allows the user to download their drawn items. These drawnItems are exported as GeoJSON using the following code from here: document....
1
vote
0answers
279 views

Leaflet Marker render

I now have a map and get the basic of the map from a geoJSON file. Now i have a websocket and sent always positions from 3 different people. So how can i add a marker , which i can move to another ...
0
votes
1answer
675 views

Importing Leaflet Draw NGX for angular 4

I followed the steps from the main git: https://github.com/Asymmetrik/ngx-leaflet first I installed the required libraries (leaflet, leaflet-draw, leaflet-ngx, and leaflet-draw-ngx) then I declared ...
2
votes
1answer
2k views

React-Leaflet-Draw: accessing a polygon's array of coordinates on save

I've got a component which puts an editable polygon on the map. When the user hits the "save" button, I want to access an array of the polygon's new vertices, so that I can save them. How do I do ...
1
vote
1answer
2k views

How to detect “delete” or “edit” events in popup menu created with Leaflet-draw-toolbar plugin?

In this example you may create a polygon and then click it and popup menu shows. There is three buttons: edit, delete and pick a color. How can I detect event and determine which of it - delete or ...
1
vote
1answer
1k views

Correct method to save and restore leaftlet drawing into mysql database

I have the following code for saving my coordinates of what I draw. So what I do on drawing created I have the following function. map.on(L.Draw.Event.CREATED, function (e) { var type = e....
1
vote
0answers
397 views

While Dragging, created marker with connected polyline from toolbar,previous polyline between two marker deleted using leaflet?

When dragging created marker with connected polyline from toolbar,previous polyline between two marker automatically deleted or auto connect from with new draggable marker? I'm try to dragging ...
1
vote
0answers
61 views

Can't execute Leaflet Layers properly

https://jsfiddle.net/324h2d9q/87/ I tried to make a map with Leaflet where I have multiple layers where I sort things via category, but it seems that it is not working... If I click on ,,Muzee", it ...
3
votes
1answer
384 views

how to save drawable entities with leaflet.draw/draw polygons into my Postgis database with getting also the coordinates

I am very new to creating webmaps with Leaflet and I am trying to save my shapes I draw into my postgis db. I would prefer to be saved as .shp or any default format (i.e. json) with its geometry field....
1
vote
1answer
830 views

Spatial Queries in Leaflet, select polygons from (A1,A2…An) which intersect with polygon (B)

I am looking for an online solution for leaflet where I can select and export (console log, geojson, addLayer) a group of polygon from a geojson file which intersect with a drawn polygon (with leaflet ...
0
votes
1answer
1k views

Can Draw and Edit mode be enabled at the same time on Leaflet?

Imagine you want to draw several shapes (marker, linestring, polygon) and also edit them after the shape is drawn or whenerver you want having the possibility to continue adding stuff. at the moment ...
1
vote
0answers
256 views

Relating Polygons to Results in AngularJS & Leaflet

I am using Lealfet.draw tools for creating polygons and then fetching results from a database based on the coordinates of those polygons. I want to be able to relate each polygon to it's ...
1
vote
2answers
2k views

Removing tool from Leaflet Draw

I am using Leaflet draw for adding Draw toolbar to my leaflet map. I am using angular leaflet directive to add the map. I want certain elements of the draw toolbar to be removed, specifically (line ...
1
vote
0answers
205 views

Clustering polygon's created with Leaflet.Draw

I am experimenting with Leaflet at the moment and am trying to cluster polygon's that I've created with Leaflet.Draw plugin's tools. I know that clustering polygons is possible (Is it possible to ...
1
vote
2answers
621 views

Get <canvas> features inside a rectangle after drawing it

Let's start with https://jsfiddle.net/ziyuang/dfekwzhd/ Say, now I want to allow users to specify areas by drawing rectangles. After the map having a rectangular area, I want to have the information, ...