Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [leaflet-draw]

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

-1
votes
0answers
16 views

Leaflet Draw - Saving vertices latitude / longitudes of user-drawn polygon

How would I go about saving the latitude and longitudes of a user-drawn polygon in Leaflet Draw? I assume this could either be done as the polygon is being drawn, saving on each new vertices, or by ...
0
votes
0answers
35 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
48 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
40 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
18 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
35 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
38 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
24 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
91 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
47 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
131 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
139 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
187 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
392 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
156 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
164 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
347 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
274 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 ...
0
votes
1answer
1k 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
632 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
0answers
99 views

The map pane puts the polygons below the layers

I'm using Leaflet 1.3.1. Adding services via ArcGIS REST API: map.createPane(service); let new_service = L.esri.dynamicMapLayer({ pane:service, url: url, opacity : 1, ...
0
votes
2answers
3k 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
0answers
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
71 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
264 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
574 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....
0
votes
0answers
207 views

Change style of leaflet draw

I want to change the style of edges that I think are ugly in leaflet draw ( I'm speaking about the big rectangles ), I did some research on internet and found that I need to do something like: ...
0
votes
0answers
231 views

Submit a form from within a leaflet popup save in data base?

I have a leaflet map in angular 4 and I want to add park out a form in a leaflet popup and upon clicking the 'submit' button - the information in the form will be inserted into my MySQL database.I try ...
0
votes
0answers
414 views

leaflet toolbar in typescript?

I'm new in using the leaflet map with angular 4. How do I add a leaflet toolbar with type script? I find only a toolbar with javascript this is my map.component.ts import { MapService } from './../...
1
vote
0answers
243 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
611 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
333 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
59 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 ...
2
votes
0answers
286 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
681 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
737 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
227 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
190 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
541 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, ...
1
vote
0answers
52 views

How can the users of my map add their favorite places [closed]

I want to create a map where the users of my website can add their favorite touristic places by clicking on the map and add some attributes. I don't mind if it's done by Leaflet openlayers or any ...
-1
votes
1answer
496 views

Finding the centre of a circle drawn using leaflet draw and also calculating the distance between 2 lat longs

Am new to JS so the below queries may look simple. Query: I have drawn multiple circles on the map and i need to fetch all the markers details available with in the circle. In order to achieve that ...
8
votes
1answer
2k views

How to enable a Leaflet Draw tool programatically

I'm using the Leaflet Draw control, and would like to enable/activate a particular tool (Draw Polygon) using JavaScript, so that this tool is active when the page loads. Is this possible? https://...
1
vote
0answers
511 views

Select multiple choice of marker - leaflet draw angular 2

I want to create a function that can select multiple choice of marker like Mapmarker National Geographic using a leaflet draw component. I already created a toolbar that the user can draw polylines, ...
2
votes
1answer
298 views

Allow popups to show through another layer

I have a Leaflet feature layer (Layer1) with popups bound. I'm using Leaflet Draw to draw a polygon in Layer2 over the feature layer. I want to then be able to open the popups for Layer1 while still ...
1
vote
0answers
549 views

Download google tile layer maps

I am using google map in leaflet like this var osmUrl = 'http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}', osmAttrib = '&copy; <a href="http://openstreetmap....