Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leaflet.draw extension #266

Closed
JamesPiggles opened this issue Jan 17, 2014 · 4 comments
Closed

Leaflet.draw extension #266

JamesPiggles opened this issue Jan 17, 2014 · 4 comments

Comments

@JamesPiggles
Copy link

Hello there,
I'm currently trying to extend leaflet.draw to include freehand polygons. Letting the user draw a free hand shape onto the map and then converting it to a simplified polygon of, say, no more than 20 sides.

I'm considering using a html 5 canvas to map the co-ordinates of the user's dragging and an as yet undertermined algorithm to simplify the points from thousands to ~20 or so. Then passing this back to leaflet polygon function to render it on the map.

I'm intending to contribute back to the plugin if my extension is successful.

I was wondering if anyone had attempted this before and had any thoughts on implementation?

JP

@JamesPiggles
Copy link
Author

Hello again!
I've managed to make a neat plugin for leaflet.draw that allows freehand polygons to be drawn. However, it depends on the leaflet html5 canvas layer plug in for the initial drawing. This is the only external dependency and all the simplification etc is contained within the freehand draw handler. The plug in used is: https://github.com/CartoDB/Leaflet.CanvasLayer

I would like to push this extension to the leaflet.draw code base and was wondering if you had any preferences on how to go about this?

@jacobtoye
Copy link
Member

Hi @JamesPiggles, adding major features like this to the codebase is a hard task. What I usually do is either leave the issue or pull open and direct people interested there. We could add a section to the readme that lists notable extensions.

@Gmitry
Copy link

Gmitry commented Apr 6, 2014

Thank you for really good work with the Leaflet Draw. It had really been great to have a "freehand" draw function e.g. based on configurable length increment or optionally a time increment to optimize the number of nodes along such freehand drawn lines.

To add a configurable parameter function for users as part of the menu-bar had as well been great.

Then as well could set user named layers for the drawn contents as well as a parameter for spline/quad control settings of the line on the particular layer (see some similar to the spline setting in kinematicjs lib). Other parameters today in the developer environment could then as well been lifted to the same user config.

@nzifnab
Copy link

nzifnab commented Jul 28, 2014

@JamesPiggles where is the code to your draw extension? You should link to it from here. I can't find it on your leaflet fork from your github page, and I'm looking for functionality similar to that as opposed to the click-click-click to draw polygons that Leaflet.Draw currently supports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants