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

Split/join lines #97

Open
danpat opened this issue Feb 28, 2013 · 17 comments
Open

Split/join lines #97

danpat opened this issue Feb 28, 2013 · 17 comments

Comments

@danpat
Copy link

danpat commented Feb 28, 2013

Would be nice to have a tool that lets you split and/or join lines.

I have some very long GPS traces that need to be chopped into segments (I'm tracing ski trails).

Conversely, I have multiple GPS traces that sometimes need to be joined together into a single line.

@jacobtoye
Copy link
Member

At this stage I'd like to keep the drawing and editing tools simple and as lightweight as possible. This requirement is quite specific. It would be good to see if many people have this requirement.

Ideally Leaflet.draw would support adding extra buttons to the toolbar. This would allow devs to add custom functionality to the plugin.

@ghost
Copy link

ghost commented Mar 1, 2013

i too have a requirement to close the poylines.
also need to be able to add & delete points in between and rotate a whole block.

@jacobtoye
Copy link
Member

For closing polylines do you mean create a polygon?

To create a point put the feature in edit mode then drag the midpoint. Midpoints are represented by a semi transparent marker between two vertices. You can delete a point by clicking on a vertex while in edit mode.

@ghost
Copy link

ghost commented Mar 1, 2013

Urs but I need to be able to close a poly line. In the world of cad this
means that the poly line joins back onto itself.
On 01/03/2013 6:10 PM, "Jacob Toye" notifications@github.com wrote:

For closing polylines do you mean create a polygon?

To create a point put the feature in edit mode then drag the midpoint.
Midpoints are represented by a semi transparent marker between two
vertices. You can delete a point by clicking on a vertex while in edit mode.


Reply to this email directly or view it on GitHubhttps://github.com//issues/97#issuecomment-14299933
.

@jacobtoye
Copy link
Member

So it doesn't need to specifically join at the starting vertex, rather anywhere along the polyline?

@ghost
Copy link

ghost commented Mar 1, 2013

No always at the starting vertex when your initially making it.
Typically this is done by inferring that if the user is finally at the
first vertex then you should indicate that another click will close the
poly line.

You also need to be able to open it by simply deleting any one out more
vertex too.

Or you can keep it together. This is my preferred way of interacting with a
poly line.
In this case the only way to open a poly lone is to select a vertex and
choose delete and open

On 01/03/2013 6:25 PM, "Jacob Toye" notifications@github.com wrote:

So it doesn't need to specifically join at the starting vertex, rather
anywhere along the polyline?


Reply to this email directly or view it on GitHubhttps://github.com//issues/97#issuecomment-14300678
.

@jmkelly
Copy link
Contributor

jmkelly commented Mar 4, 2013

Just to weigh in, but I too will need to be able to split polyline and perhaps join them back up again at some point.

For my uses, closing a polyline is a low priority, as anytime I need to do that I am just using a polygon.

I like the extra button / tool support idea for people to build their own custom tools / plugins, to keep the base functionality low. Perhaps the split could be a first example of this?

@ghost
Copy link

ghost commented Mar 4, 2013

main thing is that a plethora of plugins are possible.

A choice of polyline plugins for different uses

g

On 5 March 2013 00:14, James Kelly notifications@github.com wrote:

Just to weigh in, but I too will need to be able to split polyline and
perhaps join them back up again at some point.

For my uses, closing a polyline is a low priority, as anytime I need to do
that I am just using a polygon.

I like the extra button / tool support idea for people to build their own
custom tools / plugins, to keep the base functionality low. Perhaps the
split could be a first example of this?


Reply to this email directly or view it on GitHubhttps://github.com//issues/97#issuecomment-14412987
.

Contact details:
+49 1573 693 8595 (germany)
+46 73 364 67 96 (sweden)
skype: gedw99

@jmkelly
Copy link
Contributor

jmkelly commented Mar 4, 2013

Right now a plethora is not a problem, there are 0. Once the number of plugins gets to the point where it is unmanageable in a map, then I'm sure they will be able to be grouped, but that's not worth thinking about this early on.

@ghost
Copy link

ghost commented Mar 4, 2013

I expect many plugins to take off because the plugin architecture is pretty
easy to cope with.

And Leaflet is getting allot of media exposure now.

g

On 5 March 2013 00:35, James Kelly notifications@github.com wrote:

Right now a plethora is not a problem, there are 0. Once the number of
plugins is not easy to be added, then I'm sure they will be able to be
grouped, but that's not worth thinking about this early on.


Reply to this email directly or view it on GitHubhttps://github.com//issues/97#issuecomment-14414386
.

Contact details:
+49 1573 693 8595 (germany)
+46 73 364 67 96 (sweden)
skype: gedw99

@jmkelly
Copy link
Contributor

jmkelly commented Mar 4, 2013

I'm not saying the number won't expand, I'm saying it is not an issue now, so don't waste time trying to preempt something that may not happen. The whole idea of plugins is that they are loosely coupled to Leaflet.draw, so that if Leaflet.draw wants to change how it deals with plugins, then it is free to do so without affecting the plugins themselves. So if Leaflet.draw down the track has 500 plugin buttons and wants to group them, then it can do so, and expose this through it's API with (hopefully) no breaking changes to the plugins.

@ghost
Copy link

ghost commented Mar 5, 2013

ok i see now what you mean.

sounds like a good architecture indeed. I am looking forward to getting
cracking on some of these plugin ideas i have.

Some i am thinking about:

  1. Dimensions that "stick" to underlying objects in the map.
  2. Labels with leaders that "stick" to underlying objects in the map.

If they stick the idea is that IF the objects in the map move, the
Dimensions and Labels also move.
So they are linked by each others meta data.

Do you know if this is feasible with the current architecture ?

On 5 March 2013 00:48, James Kelly notifications@github.com wrote:

I'm not saying the number won't expand, I'm saying it is not an issue now,
so don't waste time trying to preempt something that may not happen. The
whole idea of plugins is that they are loosely coupled to Leaflet.draw, so
that if Leaflet.draw wants to change how it deals with plugins, then it is
free to do so without affecting the plugins themselves. So if Leaflet.draw
down the track has 500 plugin buttons and wants to group them, then it can
do so, and expose this through it's API with no breaking changes to the
plugins.


Reply to this email directly or view it on GitHubhttps://github.com//issues/97#issuecomment-14414906
.

Contact details:
+49 1573 693 8595 (germany)
+46 73 364 67 96 (sweden)
skype: gedw99

@sarcanon
Copy link

Any progress on this Issue? I, too, would dearly like to have the ability to split and join Polylines.

Specifically, the ability to:

  1. Select any vertex on a Polyline and split it at the selected vertex into two Polylines, and
  2. Drag one Polyline until one of its terminal vertices overlaps another Polyline's terminal vertex, and have the two Polylines be joined into a single Polyline.

That would be a godsend.

Alternately, if this is not something that will happen in the foreseeable future, can anyone comment on the difficulty of doing this for an entry-level but enthusiastic JS programmer? Many thanks.

@greyeagle
Copy link

This is a rather old thread but anyhow: Splitting polygons is really important to me as well. I get tons of large polygons that need to be "cut in pieces" to make sense.
Thanks for any hint pointing me to the right solution.

@visernchua
Copy link

Any progress on this issue? Any plugins able to do that right now?

@twolfvb
Copy link

twolfvb commented Jun 8, 2017

I need to do something like this. If anyone would like to provide some tips onto how to tackle this, it would be much appreciated.
I need to support graphs, so I currently save the endpoints of every linestring as different nodes. I thought I could add the geometry points on the map, and then selecting the corresponding to the ends I want to join so I could merge them.

Any kind of help is appreciated.

I tried to start off using
var modifiedDraw = L.drawLocal.extend({ draw: { toolbar: { buttons: { polygon: 'Draw an awesome polygon' } } } }); as was hinted by the documentation, but I ended up having TypeError, extend is not a function.

@ddproxy
Copy link
Member

ddproxy commented Jul 6, 2017

@twolfvb Use Leaflet 1.0.3 - bugs were brought up with the release of L 1.1.0 -
see #739

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

8 participants