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

Add posibility to append new point to existing line #291

Open
der-On opened this issue Apr 28, 2014 · 13 comments
Open

Add posibility to append new point to existing line #291

der-On opened this issue Apr 28, 2014 · 13 comments

Comments

@der-On
Copy link

der-On commented Apr 28, 2014

It should be possible to append new points to an already existing line.

@peterb-2795
Copy link

When your line is in edit mode, dragging on a midpoint marker (between nodes) and then dropping it will effectively create two new midpoint markers and convert the dragged midpoint marker into a node. You can repeat this ad-infinitum to create as many new points as you might wish.
Before:
image
After:
image

@der-On
Copy link
Author

der-On commented Apr 29, 2014

Thank you. I know this feature and use it extensively however I find it more "natural" to append new points to the end of the line. Currently I have to drag a point near where I want my polyline to end and then create the nessecary points in between. The main problem I see here is that one can edit all existing features at once while in "edit" mode and thus it's hard to tell at which polyline the user want's to add new endpoints. Maybe Ctrl+Drag of a point could "extrude" a new point out of it (if it's an end-point)?

Please tell me what you think?

@peterb-2795
Copy link

You can programatically ensure that there is only one feature (layer) available in the edit layer group, and then invoke the edit functionality. This ensures that there is no confusion about what is being edited... I don't know whether a ctrl+drag operation would interfere with anything else, but certainly the idea of holding an endpoint fixed whilst extending the line onwards (or in another direction) has its merits. I'd +1 on that as an enhancement (probably endpoints only else if it were possible on other nodes, it would become a multiLinestring). Identifying and editing individual features is not an issue though....

Before:
image

Edit 1:
image

Edit 2:
image

@mourner
Copy link
Member

mourner commented May 2, 2014

While drawing some tourist routes in the Mapbox editor for my friends, just discovered that I'd love to see this too. :) E.g. someone draws a route, then accidentally triggers draw end — how would he go back to drawing the line? I'd expect maybe enabling the draw mode again if you click on the last point, or at least have it as an option. @jacobtoye thoughts?

@adrianritchie
Copy link

This is something I really need in a collaborative mapping tool I'm creating. The only way I can see to get the functionality I want is to have the users create a start and end point and then drag out the nodes in between. That really isn't very intuitive and users would expect to be able to continue drawing at the end of the path.

@plepe
Copy link

plepe commented Sep 15, 2015

+1

In fact, I think it's too easy to delete a node by just clicking on it. Maybe a Ctrl+Click or so would be more intuitive?

@der-On
Copy link
Author

der-On commented Sep 15, 2015

What about using a keyboard shortcut "e" to extrude the currently selected point (would only work for start and end points)

@mdomnita
Copy link

mdomnita commented Apr 12, 2017

Has this been implemented by chance? Or did anyone manage to find a simple solution to simulate this?

I really need this feature and the only thing I could think of to achieve it was something complicated like:

  • get into edit mode with the polyline
  • find a way to trigger continuing line (like a keypress or a right click on the last marker, quite complicated as the handlers are not initialised when the EDITSTART event is called and I have no way to know when the handlers finished initialisation)
  • get back to drawing mode and programatically add all points from your existing layer (polyline)
  • delete existing layer and let the user continue line from the last point

The OpenStreetMap ID editor (for example) has a very nice feature to append points to existing line, click a "PLUS" button there and continue the line. I would like some functionality similar to that.

@sumitkamath
Copy link

You can use the addLatLng() method -- http://leafletjs.com/reference-1.0.3.html#polyline

@germanjoey
Copy link

mdomnita - if #651 was merged in, you could just capture map.on(L.Draw.Event.EDITHOOK to get the editHandler. Unfortunately, it looks like the maintainers of L.Draw have lost interest in this project. However, feel free to merge it for yourself.

(note: if you're interested, please let me know because there's a few small bugfixes for that code that I've developed in the last 5 months that I've never pushed in)

@answerquest
Copy link

I've posted a spinoff feature request at iD editor repo related to this: openstreetmap/iD#5426

@Candyffm
Copy link

@mdomnita man, you should really work on your github formatting skills.

@mdomnita
Copy link

mdomnita commented Jul 12, 2020

@mdomnita man, you should really work on your github formatting skills.

I'm sorry that my comment from 2017 bothered you two years after anyone touched this project. I hoped that my hack might help someone get this issue solved and did not have time for a PR then. Apparently, it didn't... so I deleted it now and it will not bother anyone in the future.

Thanks.

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

10 participants